Advertisement
RobertDeMilo

RB3.5 new и delete для объектов классовых типов

Apr 16th, 2024
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4. #include <vector>
  5. #include <random>
  6. using namespace std;
  7.  
  8. struct Widget
  9. {
  10.     Widget()
  11.     {
  12.         cout << "constructor" << endl;
  13.     }
  14.     ~Widget()
  15.     {
  16.         cout << "destructor" << endl;
  17.     }
  18. };
  19.  
  20. int main()
  21. {
  22.     Widget * w = new Widget;
  23.     delete w;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement