Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class transport{
- string name_transport;
- public:
- void set(string name_transport){
- this->name_transport = name_transport;
- }
- string name_tr(){
- return name_transport;
- }
- };
- class automobile: public transport{
- string name_automobile;
- public:
- void set1(string name_automobile){
- this->name_automobile = name_automobile;
- }
- string name_auto(){
- return name_automobile;
- }
- };
- class driver : public automobile{
- string name;
- public:
- void set3(string name){
- this->name = name;
- }
- string name_drivers(){
- return name;
- }
- };
- class drivers_taxi: public driver{
- int cash;
- public:
- void set4(int cash){
- this->cash = cash;
- }
- int cash_taxi(){
- return cash;
- }
- };
- class official_driver: public driver{
- int cash;
- public:
- void set5(int cash){
- this->cash = cash;
- }
- int cash_official(){
- return cash;
- }
- };
- class truck_driver: public driver{
- int cash;
- public:
- void set6(int cash){
- this->cash = cash;
- }
- int cash_truck(){
- return cash;
- }
- };
- int main() {
- setlocale(LC_ALL, "rus");
- official_driver worker1;
- worker1.set("Легковой транспорт");
- cout << worker1.name_tr() << endl;
- worker1.set1("Тойота");
- cout << worker1.name_auto() << endl;
- worker1.set3("Иванов Михаил Дмитриевич");
- cout << worker1.name_drivers() << endl;
- worker1.set5(75000);
- cout << worker1.cash_official() << endl;
- cout << "-------------------------------" << endl;
- drivers_taxi worker2;
- worker2.set("Легковой транспорт");
- cout << worker2.name_tr() << endl;
- worker2.set1("Фольксваген");
- cout << worker2.name_auto() << endl;
- worker2.set3("Петров Руслан Дмитриевич");
- cout << worker2.name_drivers() << endl;
- worker2.set4(36500);
- cout << worker2.cash_taxi() << endl;
- cout << "-------------------------------" << endl;
- truck_driver worker3;
- worker3.set("Грузовой транспорт");
- cout << worker3.name_tr() << endl;
- worker3.set1("Камаз");
- cout << worker3.name_auto() << endl;
- worker3.set3("Смирнов Олег Вадимович");
- cout << worker3.name_drivers() << endl;
- worker3.set6(120000);
- cout << worker3.cash_truck() << endl;
- cout << "-------------------------------" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement