Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <string>
  4. #include <set>
  5. #include <algorithm>
  6.  
  7. using namespace std;
  8.  
  9. class A
  10. {
  11. int x;
  12. static int * ptr;
  13. public:
  14. void Inicjalizuj();
  15. void Wyczysc();
  16. void Pokaz();
  17. };
  18.  
  19. int * A::ptr = NULL;
  20.  
  21. void A::Inicjalizuj()
  22. {
  23. ptr = new int;
  24. cin >> *ptr;
  25. }
  26.  
  27. void A::Wyczysc()
  28. {
  29. delete ptr;
  30. }
  31.  
  32. void A::Pokaz()
  33. {
  34. cout << *ptr << endl << endl;
  35. }
  36.  
  37. int main()
  38. {
  39. A obj;
  40. obj.Inicjalizuj();
  41. obj.Pokaz();
  42. obj.Wyczysc();
  43. obj.Pokaz();
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement