class Chicken {
public:
virtual
~Chicken( )
{ }
virtual void
call( ) = 0;
};
class Rooster : public Chicken {
void
call( )
{ cout << "cocka-doodle-doo" << endl; }
};
class Hen : public Chicken {
void
call( )
{ cout << "cluck cluck" << endl; }
};
class Chick : public Chicken {
void
call( )
{ cout << "peep peep" << end; }
};
Chat with our AI personalities
Rayon, Nylon, banlon, chicken nuggets
Private members are not inherited from the parent class.
false sealed classes cannot be inherited
the chicken and the cockerels have to breed in order to lay eggs they would have genes with inherited characteristics. they would also have some environmental characteristics like weight if you'd feed them too much.
Yes - in Java, every class has this method, which is inherited from the Object class. Often, the inherited method does nothing particularly useful, but you can override it with your own implementation.