Advertisement
Josif_tepe

Untitled

Dec 2nd, 2023
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 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 four_wheels : public Vehicle {
  12. public:
  13.     four_wheels() : Vehicle() {
  14.         cout << "Four wheels" << endl;
  15.     }
  16. };
  17. class Car : public four_wheels {
  18. public:
  19.     Car() : four_wheels() {
  20.         cout << "Car" << endl;
  21.     }
  22. };
  23. int main()
  24. {
  25.    
  26.     Car c;
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement