C++ and inheritance in abstract classes
i have a problem in properly handling method overriding where an abstract class is present inside my classes hierarchy. I'll try to explain: class AbstractClass{ public: virtual void anyMethod() = 0; }; class A : public AbstractClass { void anyMethod() { // A implementation of anyMethod cout << "A"; } }; class B : public AbstractClass { void anyMethod() { // B implementation of anyMethod cout << "B"; } }; AbstractClass *ptrA, *ptrB; ptrA = new A(); ptrB = new B(); ptrA->anyMethod(); //prints A ptrB->anyMethod(); //prints B Ok..previous example work fine .. the concrete implementation of the