andrelievable

zad 1

Nov 23rd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1.  
  2. #include <cstdio>
  3. #include <stdexcept>
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. class Test
  9. {
  10.    
  11. public:
  12.    
  13.     Test()
  14.     {
  15.         cout << "wywolujemy konstruktor bezargumentowy" << endl;
  16.     }
  17.  
  18.     Test(const Test& test)
  19.     {
  20.         cout << "wywolujemy konstruktor kopiujacy" << endl;
  21.     }
  22.  
  23.     ~Test()
  24.     {
  25.         cout << "wywolujemy destruktor" << endl;
  26.     }
  27.  
  28.     void ref_metoda(Test& test)
  29.     {
  30.         cout << "argument przekawywany przez referencje" << endl;
  31.     }
  32.  
  33.     void wart_metoda(Test test)
  34.     {
  35.         cout << "argument przekawywany przez wartosc" << endl;
  36.     }
  37.  
  38.     void wsk_metoda(Test* test)
  39.     {
  40.         cout << "argument przekawywany przez wskaznik" << endl;
  41.     }
  42.    
  43. };
  44.  
  45. int main()
  46. {
  47.     Test arg, *ptr;
  48.    
  49.     //arg.wart_metoda(arg);
  50.    
  51.     arg.wsk_metoda(&arg);
  52.  
  53.     //arg.ref_metoda(arg);
  54.  
  55.     return 0;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment