Question: please help me with this home work exercise: Write a C++ (CPP) program for Bus, Car, Bike following specifications : {polymorphism} (i) Design the Bus

please help me with this home work exercise:

Write a C++ (CPP) program for Bus, Car, Bike following specifications : {polymorphism}

(i) Design the Bus class having these members:

1.a member variable for the name of the class.

2.A member variable for years that car was built

3.A constructor

4. An Accessor and a Mutator.

5. Virtual print function that display the year and name.

(ii). Design a Car class derived from Bus class , having members below-

1. a member variable for maximum number of passengers , int type.

2. a constructor.

3. an accessor

4. a mutator.

5. a print function over ride the base class( in the Car class print print function it should only display name and maximum number of passangers).

(iii). In Bike class which is derived from Bus class . having the below members-

1.a member variable for maximum number of passengers , int type.

2. A constructor.

3. An accessor

4. A mutator.

5. A print function over ride the base class( in the Car class print print function it should only display name and maximum number of passangers).

(iv). In main() , there is an array of Bus pointers . the array element should be initialized with the address of dynamically allocated Bus, Car and Bike objects . the program then step through the array , calling each object print function .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!