Advertisement
Josif_tepe

Untitled

Mar 29th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class Student {
  6. private:
  7.     char ime[50];
  8.     char prezime[50];
  9.     int godini;
  10. public:
  11.     Student() {}
  12.     Student(char *i, char *p, int g) {
  13.         strcpy(ime, i);
  14.         strcpy(prezime, p);
  15.         godini = g;
  16.     }
  17.     const char* get_ime() {
  18.         return ime;
  19.     }
  20.     const char* get_prezime() {
  21.         return prezime;
  22.     }
  23.     int get_godini() {
  24.         return godini;
  25.     }
  26. };
  27. int main() {
  28.     Student s("a", "a", 10);
  29.     Student s2 = s;
  30.     cout << s.get_ime() << " " << s.get_prezime() << " " << s.get_godini() << endl;
  31.    
  32.     return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement