Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Practicing more with Inheritance, Nested classes, and Operator overloading Objective: The purpose of this lab exercise is to improve your understanding about inheritance, nested classes,
Practicing more with Inheritance, Nested classes, and Operator overloading Objective: The purpose of this lab exercise is to improve your understanding about inheritance, nested classes, and operator overloading in C++. Animals are classified into mammals, birds and fish, bats are birds and mammals. For animals in general we need to keep their weight, age, name, and the distance they can travel. For the distance we keep its length and number of hours needed for that to be completed. For mammals, we need number of times they give birth per year. For birds we need to keep number of eggs they lay down per month, and for fish, we need length, width and thickness Define a static variable to keep number of objects in each class. Define these classes and for each class overload the input, output, comparison operator >= which compares two objects in each class. For animals X>=Y if weight of X >= Weight of Y, for birds, X>=Y if number of eggs by X >= those by Y, for fish X>=Y if thickness of X is >= that of Y, for mammals X>=Y if number of times C gives birth is >= that of Y. Write a main program to demonstrate all the functions defined above for the classes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started