Advertisement
Josif_tepe

Untitled

Oct 28th, 2021
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Car {
  5. private:
  6.     string model;
  7.    
  8. public:
  9.     Car() {}
  10.     Car(string _model) {
  11.         model = _model;
  12.     }
  13.     string get_model() {
  14.         return model;
  15.     }
  16.     void set_model(string s) {
  17.         model = s;
  18.     }
  19. };
  20. class SUV : public Car {
  21. private:
  22.     bool is4x4;
  23. public:
  24.     SUV(string _model, bool _is4x4) : Car(_model) {
  25.         is4x4 = _is4x4;
  26.     }
  27.     void set4x4(bool b) {
  28.         is4x4 = b;
  29.     }
  30.     bool get_is4x4() {
  31.         return is4x4;
  32.     }
  33. };
  34. int main() {
  35.  
  36.     SUV s("audi", true);
  37.    
  38.     s.
  39.     return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement