Advertisement
Josif_tepe

Untitled

May 5th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <queue>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. class Student {
  9. protected:
  10.     int indeks;
  11. public:
  12.     static int broj_na_fakultet;
  13.     Student(int ind) {
  14.         indeks = ind;
  15.     }
  16.     int get_indeks() {
  17.         return indeks;
  18.     }
  19.    static int get_broj() {
  20.         return broj_na_fakultet;
  21.     }
  22.     static void set_broj(int broj) {
  23.         broj_na_fakultet = broj;
  24.     }
  25.    
  26. };
  27.  
  28. int Student::broj_na_fakultet = 0;
  29.  
  30. int main() {
  31.     Student s1 (123);
  32.     Student s2(456);
  33.    
  34.     s1.set_broj(14);
  35.    
  36.    
  37.    
  38.     cout << s1.get_broj() << endl;
  39.     cout << s2.get_broj() << endl;
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement