language: C++ 4.7.2 (gcc-4.7.2)
date: 302 days 18 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include "stdio.h"
#include "string.h"
#include <stdlib.h>
#include <vector>
 
class A {
public:
 
    void tellSomething() {
        std::cout << "A!" << std::endl;
    }
 
    ~A() {
        std::cout << "Destructor" << std::endl;
    }
};
 
int main(int argc, const char *argv[])
{
    std::vector<A *>* v = new std::vector<A *>;
 
    A *a1 = new A;
    A *a2 = new A;
 
    a1->tellSomething();
 
    v->push_back(a1);
    v->push_back(a2);
 
    delete v;
 
    a1->tellSomething();
 
    return 0;
}