Professional Documents
Culture Documents
class vehicle
{
protected:
string vehicleName;
public:
string vehicleType;
int wheels;
int doors;
public:
void showVehicle()
{
cout<<"Vehicle Type= "<<vehicleType<<endl;
cout<<"Wheels= "<<wheels<<endl;
cout<<"Doors= "<<doors<<endl;
}
} ;
public:
void setCarInfo (string n,int m,string col)
{
carName=n;
model=m;
color=col;
}
void showVehicle()
{
cout<<"Car name: "<<carName<<endl;
cout<<"Model: "<<model<<endl;
cout<<"Color: "<<color<<endl;
}
};
public:
void showVehicle()
{
cout<<"Name of SUV: "<<suvName<<endl;
cout<<"Model of SUV: "<<model<<endl;
cout<<"Make: "<<make<<endl;
cout<<"color: "<<color<<endl;
cout<<"Engine Size: "<<engSize<<endl;
}
};
int main()
{
vehicle*v;
motorVehicle mv;
car C1;
suv s;
v->setVehicleName("SAGA");
mv.setMotor("4 wheeler",4,4);
C1.setCarInfo("SCODA",78390004,"GRAY");
s.setSUVinfo("HERRIER",7635634,"USA","Black",222348);
v=&mv;
v->showVehicle();
v=&C1;
v->showVehicle();
v=&s;
v->showVehicle();