Advertisement
TwITe

Untitled

Dec 29th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <memory>
  3. using namespace std;
  4.  
  5. class A {
  6. public:
  7.     int *data;
  8.  
  9.     A(int *d) : data(d) {
  10.         throw runtime_error("err");
  11.     }
  12. };
  13.  
  14. class B {
  15. public:
  16.     int *data2;
  17.     A *a;
  18.  
  19.     B()
  20.     try : data2(new int[10]), a(new A(new int[2])) {}
  21.     catch (exception e) {
  22.        // delete[] data2;
  23.         //delete a;
  24.     }
  25. };
  26.  
  27.  
  28. int main() {
  29.     B b;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement