Advertisement
Guest User

Untitled

a guest
Nov 13th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <vector>
  3.  
  4. class Thing{
  5.  public: ~Thing() { printf("~Thing is going away\n"); }
  6. };
  7.  
  8. class BASE {
  9.  public:
  10. //  virtual ~BASE() {}
  11. };
  12.  
  13.  
  14. class DER : public BASE {
  15. public:
  16.   DER() { v.push_back(Thing()); }
  17.   std::vector<Thing> v;
  18. };
  19.  
  20. int main() {
  21.  BASE* b = new DER();
  22.  printf("Now deleting the container. If you don't see a ~Thing below, memory is leaking\n");
  23.  delete b;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement