Advertisement
Josif_tepe

Untitled

Apr 20th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. class Zivotno {
  6. private:
  7.     char ime_na_zivotno[51];
  8.     int tezina;
  9. public:
  10.     Zivotno() {
  11.        
  12.     }
  13.     Zivotno(char *i, int t) {
  14.         strcpy(ime_na_zivotno, i);
  15.         tezina = t;
  16.     }
  17.     ~Zivotno() {
  18.        
  19.     }
  20.     char* get_ime_na_zivotno() {
  21.         return ime_na_zivotno;
  22.     }
  23.     int get_tezine() {
  24.         return tezina;
  25.     }
  26. };
  27.  
  28. class Mesojadni : public Zivotno {
  29. private:
  30.     char vid_na_zivotno[51];
  31.     bool dali_e_divo;
  32. public:
  33.     Mesojadni() : Zivotno() {
  34.        
  35.     }
  36.     Mesojadni(char *ime_na_zivotno, int tezina, char *vid, bool d) : Zivotno(ime_na_zivotno, tezina) {
  37.         strcpy(vid_na_zivotno, vid);
  38.         dali_e_divo = d;
  39.     }
  40.     char* get_vid() {
  41.         return vid_na_zivotno;
  42.     }
  43.     bool get_divo() {
  44.         return dali_e_divo;
  45.     }
  46.    
  47. };
  48. int main() {
  49.     Mesojadni kuce("lusi", 30, "kuce", false);
  50.    
  51.     cout << kuce.get_ime_na_zivotno() << " " << kuce.get_tezine() << " " << kuce.get_vid() << "  " << kuce.get_divo() << endl;
  52. }
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement