Using C First Build Two Classes Mammal Dog Dog Inherit Mammal Mammal Class Code Mammal Cla Q37072982

Using C++ you will first build two classes, Mammal and Dog. Dogwill inherit from Mammal. Below is the Mammal class code. Once youhave the Mammal class built, build a second class Dog that willinherit publicly from Mammal

#include <iostream>

using std::cout;

using std::endl;

class Mammal

{

public:

Mammal(void);

~Mammal(void);

virtual void Move() {}; //cout class Move and display age

virtual void Speak() {}; //cout class Speak

protected:

int itsAge;

};

Once you have completed class Mammal and Dog, build thefollowing main program.

int main ()

{

   Mammal *pDog = new Dog;

//write your code to call all Mammal methods for specificobjects

   return 0;

}


Solution


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.