Question
create an Animal class that has a single private integer member called legs. Create a default constructor (that sets legs to 4) and a constructor
create an Animal class that has a single private integer member called legs. Create a default constructor (that sets legs to 4) and a constructor with parameters (that checks to make sure that legs is set between 0 and 4, and defaults to 4 otherwise). Create a single member function print() that print legs to cout.
Then create a derived Dog class with Animal as the base class that has a single private member called tail . Create a default consturctor (that sets tail to 1 calls the base constructor appropriately), and a constructor with parameters (that passes legs to the base class and sets tail to be between 0 and 1, and defaults to 1 otherwise). Create a single member function print() that prints the number of legs and tails to cout.
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