Advertisement
Josif_tepe

Untitled

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