Let's say that I have the following abstract class:
class Animal
{
private:
string _name;
int _age;
public:
Animal(const string name, const int age);
virtual void eat() = 0;
};
If I want to create a new derived class, for example, a Dog class. How do I call Animal's constructor, as Animal is an abstract class? More than this, if I'd have 2 more classes under Dog: Pug and Poodle (I know that the example isn't that good but let's ignore that). How will those two classes use Animal c'tor?
Aucun commentaire:
Enregistrer un commentaire