fork download
  1. #include <iostream>
  2. #include "stdio.h"
  3. #include "string.h"
  4. #include <stdlib.h>
  5. #include <vector>
  6.  
  7. class A {
  8. public:
  9.  
  10. std::string tellSomething() {
  11. std::cout << "A!" << std::endl;
  12. return "foo";
  13. }
  14.  
  15. ~A() {
  16. std::cout << "Destructor" << std::endl;
  17. }
  18. };
  19.  
  20. int main(int argc, const char *argv[])
  21. {
  22. std::vector<A *>* v = new std::vector<A *>;
  23.  
  24. A *a1 = new A;
  25. A *a2 = new A;
  26.  
  27. a1->tellSomething();
  28.  
  29. v->push_back(a1);
  30. v->push_back(a2);
  31.  
  32. delete v;
  33.  
  34. a1->tellSomething();
  35.  
  36. return 0;
  37. }
  38.  
Success #stdin #stdout 0.02s 2812KB
stdin
Standard input is empty
stdout
A!
A!