Design Choices

Design Choices

You are designing a class structure for a zoo management system. The system currently has an Animal class with basic attributes like name, age, and weight. You need to decide whether to create a Bird class that inherits from Animal or if Bird should be a separate class with a member variable of type Animal. Do the same thing for a member variable Wing wings that contains details like wingSpan and wingType.

Hint

Answer

In this scenario, a Bird should inherit from Animal because a bird is a type of animal, and it shares common characteristics such as name, age, and weight. The Wing details can be encapsulated in a separate Wing class that is used as a member variable within Bird.

Questions