class Foo{ enum{size = 100}; int* m_data;public: Foo(){ m_data = new int[size]; } virtual ~Foo(){ delete []m_data; }};
class Foo{ enum{size = 100}; int* m_data;public: Foo(){ m_data = new int[size]; } virtual ~Foo(){ delete []m_data; std::cout<< "Foo destructor" << std::endl; }};class Derived1: public Foo{ int x;public: Derived1():Foo(),x(0){} virtual ~Derived1(){ std::cout << "Derived1 destructor" << std::endl; }};class Derived2: public Foo{ int* m_d;public: Derived2():Foo(),m_d(0){ m_d = new int(1); } virtual ~Derived2(){ delete m_d; std::cout << "Derived2 destructor" << std::endl; }};int main(int argc, char *argv[]){ Derived1 *pd1 = new Derived1; Derived2 *pd2 = new Derived2; //do something... delete pd1; delete pd2;}
QHash<int,A*> values_;