Pointers, Referencing and De-referencing

Hello All. I am trying to better understand the uses and differences in a particular situation when it comes to pointers, references and de-referencing…

In the c++ course he goes over this and I need help understanding the differences and uses for these similar ways of doing it.

    FString Sphere = GetOwner()->GetName();
    FString* PtrSphere = &Sphere;

    UE_LOG(LogTemp, Warning, TEXT("Tis I, %s"), **PtrSphere);
    UE_LOG(LogTemp, Warning, TEXT("Tis I, %s"), *GetOwner()->GetName());
    FString Sphere = GetOwner()->GetName();

    UE_LOG(LogTemp, Warning, TEXT(Tis I, %s), *Sphere);

What was done in the lectures was to showcase what the operators are doing. Number 1 is completely unnecessary from a practical standpoint. It was only done as an illustration.

The only difference between 2 and 3 is the variable.

I think I might have misunderstood the question.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms