Answered step by step
Verified Expert Solution
Question
1 Approved Answer
class Animal { public: Animal ( ) ; virtual void set _ speed ( double new _ speed ) ; void accelerate ( double new
class Animal
public:
Animal;
virtual void setspeeddouble newspeed;
void acceleratedouble newspeed;
double getspeed const;
private:
double speed;
;
Animal::Animal
speed ;
void Animal::setspeeddouble newspeed
speed newspeed;
void Animal::acceleratedouble newspeed
speed speed newspeed;
double Animal::getspeed const
return speed;
class Cheetah : public Animal
public:
Cheetah;
void setspeeddouble newspeed;
virtual void acceleratedouble newspeed;
double getspeed const;
;
Cheetah::Cheetah
: Animal
void Cheetah::setspeeddouble newspeed
Animal::setspeedAnimal::getspeed newspeed;
void Cheetah::acceleratedouble newspeed
Animal::setspeednewspeed;
double Cheetah::getspeed const
return Animal::getspeed;
int main
Cheetah ch;
Cheetah ch new Cheetah;
chsetspeed;
chaccelerate;
chsetspeed;
chaccelerate;
Animal c new Animal;
c ch;
cout "Cheetah Speed: chgetspeed
; Animal Speed: cgetspeed;
return ;
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