How to access variables from another class in ue4 c++

Thank you, , it works so the GetWorld(); does that check to see if the game world exists? as well how would I use that code u put to use it with other class I have? for example, an actor class and another actor class thank you in advance.