class named Vehicle members
Brand
Model
Price
Color
A default constructor
A constructor that accept different arguments.
A method named display( ) that displays the values of member data with
new price.
Car inherits from Vehicle
Engine capacity
No. of passengers
A default constructor
A constructor that accept different arguments.
A method named getData( ) to input the values of member data from
Vehicle and Car class.
A method named getDiscount( ) that change the value of price.
A method named setColor( ) that change the color of the car.
#include <iostream>
using std::cout;
int main() {
cout << "class named Vehicle members
Brand
Model
Price
Color
A default constructor
A constructor that accept different arguments.
A method named display( ) that displays the values of member data with
new price.
Car inherits from Vehicle
Engine capacity
No. of passengers
A default constructor
A constructor that accept different arguments.
A method named getData( ) to input the values of member data from
Vehicle and Car class.
A method named getDiscount( ) that change the value of price.
A method named setColor( ) that change the color of the car. ";
return 0;
}
class CVehical
{
private:
int Brand ;
int model ;
float price ;
int color ;
public:
CVechical();
CVechical( int brand, int mode , float price , int color ) ;
void display() ;
void get_data() ;
~CVechical() ;
};
class CCar : public CVechical
{
private:
int capacity ;
int no_passnger ;
CCar() : CVechical() { }
void get_data() ;
void getDiscount () ;
void SetColor() ;
};