Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <memory>
- using namespace std;
- class A {
- public:
- int *data;
- A(int *d) : data(d) {
- throw runtime_error("err");
- }
- };
- class B {
- public:
- int *data2;
- A *a;
- B()
- try : data2(new int[10]), a(new A(new int[2])) {}
- catch (exception e) {
- // delete[] data2;
- //delete a;
- }
- };
- int main() {
- B b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement