Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Inheritance is a powerful tool in object-oriented programming. It allows the bui

ID: 3918448 • Letter: I

Question

Inheritance is a powerful tool in object-oriented programming. It allows the building of new classes based on already defined classes. Consider a base class named vehicle. Post a new thread that describes the following: 1. What data members would you include in the vehicle class? Are they private or protected? What member functions would you include in the vehicle class? 2. Consider and describe a derived class of the vehicle class. What is the name of the derived class? What additional data members would you include in the derived class? What functions would you add/override?

Explanation / Answer

Vehicle->

Vehicle class:

Data members of Vehicle class should be protected because scope of private modifier is within only class not in derived.

Data members:

Member Functions

Derived class of Vehicle :

There are two derived classes : TwoWheeler and FourWheeler

Data members:

Functions overrided: