how change the main camera scene?

hello people, I’m starting my study in unreal, I already took a look down into some of the tutorials that are on the wiki, but unfortunately there is not much focused on programming.

I saw you already answered this question to make blueprints, but I’m more interested in learning c++

So I started to do on their own, but I can not make the code below work. Any suggestions? Unreal always crash in this code when I test the scene.

void APDPhoenixCharacter::BeginPlay()
{
	if (CameraActor != NULL)
	{
		Cast<APlayerController>(GetController())->SetViewTarget(CameraActor);
	}
}

in the header:

UPROPERTY(EditAnywhere, Category = Camera)
ACameraActor* CameraActor;

Sorry, I found the answer in this thread: