Help accesing a component from a parent

Hello all I’m new to UDK programing and am a c++ programmer so i thought it would be easy to hop on in.
anyway i was wondering if there was a way for me to access the child camera

RootComponent = CreateDefaultSubobject<USceneCaptureComponent>(TEXT("RootComponent"));
	//make the camera
	UCameraComponent* cam = CreateDefaultSubobject<UCameraComponent>(TEXT("OurCamera"));
	//make the part we can see
	OurVisComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ourVisComp"));
	//attach everything to the root component
	cam->AttachTo(RootComponent);
	cam->SetRelativeLocation(FVector(-250.0f, 0.0f, 250.0f));
	cam->SetRelativeRotation(FRotator(-45.0f,0.0f,0.0f));
	OurVisComp->AttachTo(RootComponent);

this is where the camera and some other components put together.

so any help referencing the camera object from another method would be greatly appreciated.

i was thinking using the RootComponent seeing as that was made in the .h file and can be accessed.

Thanks in advanced!

there are several things that you can do…

+if you wanted to access from another actor or object ::

[[actor of your class]]->GetComponentByClass([YourComponentClass]::StaticClass); // gonna get you the first component of the class

+if you wanted to access the component in the class ::

  • why don’t make a class variable and used it in the class??