Advertisement
Josif_tepe

Untitled

Dec 2nd, 2023
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5. class Vehicle {
  6. public:
  7.     Vehicle() {
  8.         cout << "Vehicle" << endl;
  9.     }
  10. };
  11. class Car : public Vehicle {
  12. public:
  13.     Car() : Vehicle() {
  14.         cout << "Car" << endl;
  15.     }
  16. };
  17. class Bus : public Vehicle {
  18. public:
  19.     Bus() : Vehicle() {
  20.         cout << "Bus" << endl;
  21.     }
  22. };
  23.  
  24. class CityBus : public Bus {
  25. public:
  26.     CityBus() : Bus() {
  27.         cout << "City bus" << endl;
  28.     }
  29. };
  30. int main()
  31. {
  32.    
  33.     CityBus c;
  34.     return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement