   A little help with a class. Needs Ideas more than anything.
  Hi all, well the basics of this are that I'm making a text based RPG to help me learn about OO programming, it's in C++.Well I've only just started (only been using c++ a month), and come to a mental road block, I just need some help thinking something through.First of all, I have a class "Living_Thing", Which "Enemy" and "Person" inherit from (in a living_things header file). Now the problem is, I don't know what other functions to place in there, I already have one to cout all the stats (For debugging), modify the health, mana and exp, level up, check if exp is enough to levelup, get the physical and magical base damage.I'm using some formulas from Final Fantasy VII (as they're readily available), but would like to make some of my own. I would like it to be complete, before I start on the rest of the game (I've only outlined the enemy+person classes)Second question; Due to the sheer amount of variables needed to initialise a monster. The function (inside living_thing) to set them looks like this:void setattr(int health,int mana,int magattack, int magdefence,int atk,int def,int stam,int agi,int intel,int cha,int spir,int aware, int attract, int align,int luk, int ag, int high,int weigh, int exp,string nam,string descript,string ele)/* As you can see, it's hell. */{/* Long list of code here */};and the actual function looks like this:enems.setattr(enemyhealth,enemymana,enemyattack,enemydefence,enemymagicattack,enemymagicdefence,enemystamina,enemyagility,enemyintelligence,enemycharm,enemyspirit,enemyawareness,enemyattractiveness,enemyalignment,enemyluck,enemyage,enemyheight,enemyweight,enemyexperience,enemyname,enemydescription,enemyelement)FYI: That's in a function to read the enemies from a file, pretty much translates as:enemy.setattr(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,"Slug","A slug","Grass");I don't suppose there's a slightly easier (or more aesthetically pleasing) way to do this, is there?
  I still have to decypher the code from your second question, so I won't answer that, but I do see something you might want to change in the inheritance question.You say Person and Enemy inherit for Living_Thing. I guess Person is the playable character class. Isn't it a bit weird to put the level up function in the parent class then? I don't think the enemies need to level up in real-time, right? Isn't it better to put that function in the Person class instead of letting both Person and Enemy inherit it?   ;  RE #2:  This kind of situation can be made much more managable with some simple POD (Plain Old Data) types:struct LivingThingAttributes {    int Attack, Defense, Stamina, Agility, Intelligence, Charisma, Spirit;    ...};class LivingThing {    LivingThingAttributes attributes;public:    void setattr( const LivingThingAttributes& newattributes ) {   attributes = newattributes;    }};???? {    // instead of: enemyhealth = ...;    // we do: enemyattributes.Health = ...;    for ( ... ) {   enems.setattr( enemyattributes );    }}Private variables are great for encapsulating data, but you're not really encapsulating anything when you directly expose every single variable of a class in a big setter function -- there is a time and place for public data.  There's also less to change when you add new attributes to your things.   