fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Point {
  5. private:
  6. int x{0}, y{0};
  7. public:
  8. Point(int a, int b) {
  9. x = a; y = b;
  10. }
  11. // init типо
  12. ~Point() {
  13. cout << "DELETED!!";
  14. }
  15. void set(int a, int b) {
  16. x = a; y = b;
  17. }
  18.  
  19. void get(int& a, int& b) {
  20. a = x; b = y;
  21. }
  22. };
  23.  
  24. int main() {
  25. int x, y;
  26. Point* point = new Point(12, 21);
  27. delete point;
  28. // point.set(12, 42);
  29. // point.get(x, y);
  30.  
  31. cout << x << " " << y;
  32. }
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
DELETED!!0 0