Header Ads

Vehicle Management System | Vehicle Management System using C++ | Mini Project Vehicle Management

In This Article we Discuss How to Create Vehicle Management System | Vehicle Management System using C++ | Mini Project Vehicle Management Step by Step with Easy Example

    1. Create Vehicle Class

    2.  Create  Car Class

    3. Create Toyota Car Class

Explanation :

Create Vehicle Class and Two Child Class Car and Toyota Car Class. Car Class Inherit with Vehicle Class and Toyota Car Class Inherit with Car Class

Program Source Code:

#include<iostream>

using namespace std;

class Vehicle{

private:

string make,model;

int year;

public:

void inputData(){

cout<<"Enter Company Name : ";

cin>>make;

cout<<"Enter Model :";

cin>>model;

cout<<"Enter Year :";

cin>>year;

}

void display(){

cout<<"Make :"<<make<<endl;

cout<<"Model :"<<model<<endl;

cout<<"Year :"<<year<<endl;

}

};

class Car : public Vehicle{

private:

int numDoor;

public:

void inputData(){

Vehicle::inputData();

cout<<"Enter Number of Door :";

cin>>numDoor;

}

void display(){

Vehicle::display();

cout<<"Door :"<<numDoor<<endl;

}

};

class ToyotaCar : public Car{

private:

string trimLevel;

public:

void inputData(){

Car::inputData();

cout<<"Enter Trim Level :";

cin>>trimLevel;

}

void display(){

Car::display();

cout<<"Trime Level :"<<trimLevel<<endl;

}

};


main(){

ToyotaCar myCar;

cout<<"-------Input Car Info---------"<<endl;

myCar.inputData();

cout<<"-------Output Car Info--------"<<endl;

myCar.display();

}



Related Video:




No comments

Powered by Blogger.