Hey guys so I've been trying to gain some understanding of classes by creating a OOP program in one file that creates a player with custom or prior attributes. Then allows them to customize themselves and see what abilities they have.
The Issue:
1 2
In function 'int main()':
82:15: error: request for member 'toString' in 'newPlayer', which is of non-class type 'Player()'
I am getting this error when I attempt to create the Object then use any of its functions. When I remove the line newPlayer.toString(); and leave Player newPlayer(); I don't see my cout<<"Costructed player" from the constructor.
Hey guys sorry to bother you with my sillyness I made newPlayer (an obj type) a function type where it should be Player newPlayer; instead of Player newPlayer();
Yep... you've stumbled across what's sometimes known as the Most Vexing Parse. Although you intended line 80 to define a Player object using the default constructor, what it actually does is declare a function called newPlayer, that returns a Player object.
If I may give a piece of advice, you may want to look into overloading the extraction operator for ostream to work with your code, so you could concatenate cout with the Player class.