I have:
class A{ public: virtual void foo(); }; class B : public A{ public: void foo(); }; B *ptr = new B();
I want to call A foo() DIRECTLY using the 'ptr' pointer.
When i try
(A*)ptr->foo();
it still calls version B of foo() . How can I name the version instead?
Is it possible? What are the alternatives? Thanks.
c ++ inheritance pointers virtual
nahpr
source share