Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Derived {
- public:
- Derived() {
- cout << "Derived constructor" << endl;
- }
- ~Derived() {
- cout << "Derived destructor" << endl;
- }
- };
- class Base {
- private:
- int *a;
- public:
- Base() {
- Derived b;
- a = new int[100];
- throw runtime_error("error");
- }
- ~Base() {
- // delete[] a;
- }
- };
- int main() {
- try {
- Base base;
- }
- catch (exception e) {
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement