+ 6
Compiler doesn't recognize any of destructor operators in this code. Why?
2 Réponses
+ 6
@Squidy thank you very much....my bad, I haven't even noticed it
+ 5
It's because your bracketing is weird. You've got your destructors inside of the attack functions. Adjust your bracketing so that they're on the outside, as their own functions.
E.g.:
void attack() {
cout << "Ninja!"<<endl;
/* ~Ninja(){cout<<"Ninja dtor"<<endl;} */
}
Should be
void attack() {
cout << "Ninja!"<<endl;
}
~Ninja(){cout<<"Ninja dtor"<<endl;}