You are on page 1of 2

#include<iostream>

#include<string>
using namespace std;

//Deifining Class Seat (Base Class 1)


class seat{

public:
string seat_type;
int seat_cost;
int seat_choice;

//Defining Constructor
seat(){
cout<<"\n1. Economy:1500\n2. Business:4000\n";
cout<<"Enter your choice:";
cin>>seat_choice;
find_seat_cost();
}

void find_seat_cost(){
seat_cost=(seat_choice==1?1500:4000);
}
};

//Defining Class Meal (Base Class 2)


class meal{

public:
string meal_type;
int meal_cost;
int meal_choice;

meal(){
cout<<"\n1. Veg:200\n2. Non-Veg:400\n";
cout<<"Enter your choice:";
cin>>meal_choice;
find_meal_cost();
}

void find_meal_cost(){
meal_cost=(meal_choice==1?200:400);
}
};

//Defining Total Class (Derived Class)


class total:public seat,public meal{

public:
int total_cost;

total(){
find_total();
}

void find_total(){
total_cost=seat_cost+meal_cost;
}

void display(){
cout<<"Total Cost: "<<total_cost;
}
};

int main(){
cout<<"Implementation of Multiple Inheritance In Airline Travel Management
System\n";
total t;
t.display();
return 0;
}

You might also like