the following code has a memory leak, why?
Code:class Base { public: virtual void doSomething() = 0; }; class Derived : public Base { public: virtual void doSomething() { // Do the action } }; int main(int argc, char[] argv) { Derived* pDerived = new Derived; Base* pBase = pDerived; delete pBase; return 0; }




Reply With Quote
