I have a code in which I use a pointer to a class that I made. As an example lets say I have a Person method, and each Person had a name. Now lets say I use a pointer for a person like
Person& * person_;
Now lets say I’m trying to get the name of the person using the pointer I have. If I do something as simple as
person_.getName()
It will return an error saying that it’s a non-class type.
My question is: if all I have is the pointer to work with, how do I use the methods of the class it’s pointing to?
You use the pointer notation:
->is what you want.