I have 2 classes. The first one has in it a getfunction which returns a name
and I am trying to call that function from the second class. The first class
name is PlayerInfo
and the getfunction is:
And I call that function from the second class with:
but it does not output anything. Is there something I am doing wrong?
And I would get an error at first that said I had to have an
object declared but I don't get an error anymore since I have made the
second class a child class of PlayerInfo.
Last edited on
You can't call a (non-static) member function without an object.
It doesn't make sense to ask "what's your name?" when you're not addressing anyone.
Alright thanks. Will call from main then
It doesn't have anything to do with where you are calling it from.