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