Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Vehicle {
- public:
- Vehicle() {
- cout << "Vehicle" << endl;
- }
- };
- class Car : public Vehicle {
- public:
- Car() : Vehicle() {
- cout << "Car" << endl;
- }
- };
- class Bus : public Vehicle {
- public:
- Bus() : Vehicle() {
- cout << "Bus" << endl;
- }
- };
- class CityBus : public Bus {
- public:
- CityBus() : Bus() {
- cout << "City bus" << endl;
- }
- };
- int main()
- {
- CityBus c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement