Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <vector>
- class Thing{
- public: ~Thing() { printf("~Thing is going away\n"); }
- };
- class BASE {
- public:
- // virtual ~BASE() {}
- };
- class DER : public BASE {
- public:
- DER() { v.push_back(Thing()); }
- std::vector<Thing> v;
- };
- int main() {
- BASE* b = new DER();
- printf("Now deleting the container. If you don't see a ~Thing below, memory is leaking\n");
- delete b;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement