Answer to Question #349799 in Engineering for c++

Question #349799

Animal Inheritance

Implement the following class hierarchy, the inheritance access level should be public for all the descendent classes.

 

 


 

1. Add a protected data member named id of integer type to Animal class.

 

2. Add get/set methods for id data member in Animal class with public access.

3. Add a default constructor to each of the above created class. The constructor should initialize the id data member of Animal, Reptile, Bird and Mammal,to 0, 1, 2 and 3 respectively also it display a message “(class Name)’s default constructor”.

 

4. Add a parameterized constructor to each of the above created class. The constructor should initialize the id data member of Animal, Reptile, Bird and Mammal, to the specified id passed to the constructor as an argument ,also it display a message “(class Name)’s default constructor”. The parameterized constructor should call its base class parameterized constructor to initialize any data member inherited from the base class.

 

0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS