Josif_tepe

Untitled

Sep 9th, 2025
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. class Ucenik {
  6. private:
  7.     string ime;
  8.     float prosek;
  9.     int broj_na_polozeni_predmeti;
  10.    
  11. public:
  12.     Ucenik() {} // default(empty) constructor
  13.     Ucenik(string ime, float prosek, int broj_na_polozeni_predmeti) {
  14.         this->ime = ime;
  15.         this->prosek = prosek;
  16.         this->broj_na_polozeni_predmeti = broj_na_polozeni_predmeti;
  17.     }
  18.    
  19.     Ucenik(const Ucenik & tmp) {
  20.         this->ime = tmp.ime;
  21.         this->prosek = tmp.prosek;
  22.         this->broj_na_polozeni_predmeti = tmp.broj_na_polozeni_predmeti;
  23.     }
  24.    
  25.     string get_ime() {
  26.         return ime;
  27.     }
  28.    
  29. };
  30.  int main() {
  31.      Ucenik u1;
  32.      Ucenik u2("Josif", 9.1, 35);
  33.      Ucenik u3(u2);
  34.      
  35.      cout << u2.get_ime() << endl;
  36.      
  37.      
  38.      
  39.      
  40.      return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment