Reputation: 127
I am getting:
main.cpp(13): error C2512: 'myPlayer' : no appropriate default constructor available
Here is the code that it is referring to:
myPlayer player;
Here is the constructor:
myPlayer (int myHealth, int myDamage, int myMoney, int myWeaponID, int myClass) : health(myHealth), damage(myDamage), money(myMoney),
weapon_id(myWeaponID), p_class(myClass) {}
Also, how can I show the number for each line on Visual Studio 11?
Upvotes: 0
Views: 362
Reputation: 490018
Your constructor is declared to take 5 parameters, all of type int
. You're not supplying any parameters.
Your choices are to write a constructor that doesn't require arguments, or else supply the arguments when you construct the object, like: myPlayer player(1, 2, 3, 4, 5);
Upvotes: 6