Quote:Original post by SonicD007
Ohhhh. Thats cool. I never even heard of that until now. Also, the get and set functions were for the program to use to give a character power levels and all that. If that's bad coding please point me in a direction on how to improve it because I don't want to get any bad habbits.
It is, generally speaking, bad coding, and I already told you that. More than once. A while ago. The lowercase c prefix on the class name is quite useless, too.
Please pay close attention:
class Enemy { // I prefer to put the private stuff at the top, when possible. // That's probably unusual, though. std::string name; int power_level; int max_power_level; int attack; int defense; int ki; int max_ki; int level; int zenni; public: // A constructor is a function, so the usual rules for parameter passing // apply: i.e., prefer to pass non-primitives by const reference. // I would normally put a constructor this straightforward directly into // the class body, but here I'll separate it out so you see how it's done. Enemy(const std::string& name, int PL, int atk, int def, int ki, int lvl, int zenni);};Enemy::Enemy(const std::string& name, int PL, int atk, int def, int ki, int lvl, int zenni) : // Initializer list goes between the colon and the open brace. // Names outside the parens are the names of members as they were declared // in your class. Stuff inside the parens are the expressions that will // initialize those members. In your case, those will just be parameters. name(name), power_level(PL), max_power_level(PL), attack(atk), defense(def), ki(ki), max_ki(ki), level(lvl), zenni(zenni)// Constructor body can now be empty.{}