Advertisement
Josif_tepe

Untitled

Dec 10th, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Student {
  6. private:
  7.     string ime;
  8.     int br_na_index;
  9.     float prosek;
  10.    
  11. public:
  12.     Student() {
  13.         cout << "empty/default constructor" << endl;
  14.     }
  15.    
  16.     Student(string _ime, int _br_na_index, float _prosek) {
  17.         ime = _ime;
  18.         br_na_index = _br_na_index;
  19.         prosek = _prosek;
  20.         cout << "parameters" << endl;
  21.     }
  22.    
  23.     Student(const Student & tmp) {
  24.         ime = tmp.ime;
  25.         br_na_index = tmp.br_na_index;
  26.         prosek = tmp.prosek;
  27.         cout << "copy constructor" << endl;
  28.     }
  29.    
  30.     ~Student() {
  31.         cout << "destructor" << " " << ime << endl;
  32.     }
  33.    
  34. };
  35. int main()
  36. {
  37.     Student s1("josif", 200, 4.5);
  38.     Student s2("Ana", 100, 5.6);
  39.     Student s3("Viktorija", 900, 8.2);
  40.    
  41.  
  42.  
  43.     return 0;
  44.  
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement