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. }
  13.  
  14. ~A() {
  15. std::cout << "Destructor" << std::endl;
  16. }
  17. };
  18.  
  19. int main(int argc, const char *argv[])
  20. {
  21. std::vector<A *>* v = new std::vector<A *>;
  22.  
  23. A *a1 = new A;
  24. A *a2 = new A;
  25.  
  26. a1->tellSomething();
  27.  
  28. v->push_back(a1);
  29. v->push_back(a2);
  30.  
  31. delete v;
  32.  
  33. a1->tellSomething();
  34.  
  35. return 0;
  36. }
  37.  
Runtime error #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
A!