Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Vehicle
- {
- public:
- Vehicle(int number_of_wheels = 0, int max_speed = 0)
- : number_of_wheels{number_of_wheels}, max_speed{max_speed}
- {
- if (number_of_wheels > 6)
- {
- max_speed{100};
- }
- }
- int get_number_of_wheels() const;
- int get_max_speed() const;
- Location& get_start_point() const;
- Location& get_destination() const;
- protected:
- int number_of_wheels;
- int max_speed;
- Location start_point; //made-up class Location
- Location destination; //made-up class Location
- };
- class Passenger_Vehicle: public Vehicle
- {
- public:
- Passenger_Vehicle(int wheels = 0, int speed = 0,
- int passengers = 0, int doors = 0)
- : Vehicle{wheels, speed},
- numbers_of_passengers{passengers}, number_of_doors{doors}
- {
- }
- int get_number_of_passengers() const;
- int get_number_of_doors() const;
- private:
- int number_of_passengers;
- int number_of_doors;
- };
- class Freight_Vehicle: public Vehicle
- {
- public:
- Freight_Vehicle(int wheels = 0, int speed = 0,
- int payload = 0)
- : Vehicle{wheels, speed}, max_payload{payload}
- {
- }
- int get_max_payload() const;
- void load_freight_vehicle();
- Load& unload_freight_vehicle(); //made-up class Load
- private:
- int max_payload;
- };
Add Comment
Please, Sign In to add comment