I started learning and practicing classes.
Sorry for the long program. It works fine, it shows some instances of the class object and also let's you add a new one.
My questions is: Any ideas for further development of this program?
void getData()
{
cout <<endl;
cout <<"Enter new Hero name: "; cin>>name;
cout <<"Enter new Hero life: "; cin>>life;
cout <<"Enter new hero strength: "; cin>> strength;
cout <<"Enter new hero agility:"; cin>>agility;
cout <<"Enter new hero inteligence: "; cin>>inteligence;
}
You shouldn't put I/O in methods. You should really think about how your object is going to be used and write methods to support sensible use, rather than just thinking about what it has to do.
For example, can create files lists, vectors, strings, ... none of them start writing messages or expecting input when you use them, right?
In C++, class is used to implement a number of different concepts.
In your example, you're doing object oriented programming, inheriting Paladin and Demigod from Hero.
Having established that, there are a few comments to make.
1. Object oriented programming only works thru indirection. In C++, this means holding pointers to objects. Forget about references to begin with.
2. The base class should establish a protocol; a set of things that all Hero can do. The derived classes implement these things and possibly specialise them, as well as adding things of their own. The protocol is implemented using virtual functions.
3. You then write code that uses these Heros generically. So code that uses Heros doens't know if it's a Paladin, Demigod or something else.
So I suggest you revise what you've done in this light rather than moving on to something else.