+ 1
On classes
How to learn different types of classes?
1 Answer
+ 3
what do you mean? write some to represent various real life objects I guess..
creature->rat
class creature
{
public:
int setHealth(int health) { m_health = health;}
virtual void speak() { cout << "Creature";}
private:
int m_health;
}
class rat::public creature
{
public:
void speak() { cout << "Rat!";}
}