Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <cassert>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. class TABLICA{
  8. private:
  9. int *p;
  10. public:
  11.  
  12. TABLICA()
  13. {
  14. p = 0;
  15. cout<<"Konstruktor (bezparametrowy) domyslny"<<endl<<endl;
  16. }
  17.  
  18. TABLICA(/*const*/int * tab)
  19. {
  20. p = tab;
  21. cout<<"Konstruktor"<<endl<<endl;
  22. }
  23.  
  24. TABLICA(/*const*/ TABLICA & kopia)
  25. {
  26. p = kopia.p;
  27. cout<<"Konstruktor kopiujacy"<<endl<<endl;
  28. }
  29.  
  30. TABLICA & operator=(/*const*/ TABLICA & kopia)
  31. //lub
  32. //void operator=(/*const*/ TABLICA & kopia)
  33. {
  34. p = kopia.p;
  35. assert(p);
  36. cout<<"Operator przypisania"<<endl<<endl;
  37. }
  38.  
  39. ~TABLICA()
  40. {
  41. cout<<"Destruktor"<<endl;
  42. }
  43. };
  44.  
  45. int main()
  46. {
  47. int * liczba=0;
  48.  
  49. TABLICA t0;
  50. TABLICA t1 (liczba);
  51. TABLICA t2 = t1;
  52.  
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement