Question: Help me write a class that extends the LeggedMammal class from my codes below. Consider the breed, size and is registered. Initialize all properties of
Help me write a class that extends the LeggedMammal class from my codes below. Consider the breed, size and is registered. Initialize all properties of the parent class in the new constructor. use accessors and mutators for the new properties.
here's my code:
class LeggedMammal
{
public:
string fur, tail;
int legs;
void printfur();
void printtail();
void printlegs()
{
cout << "Number of legs: " << legs;
}
};
void LeggedMammal::printfur()
{
cout << "Fur type: "<< fur;
}
void LeggedMammal::printtail()
{
cout << "Presence of tail: "<< tail;
}
int main() {
LeggedMammal Dog;
Dog.fur="Double Coat";
Dog.legs=4;
Dog.tail="Yes";
Dog.printlegs();
cout << endl;
Dog.printfur();
cout << endl;
Dog.printtail();
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
