Hello.
For some reason my virtual base method is being called on a pointer to a derived object that overrides the virtual base method. And I don't understand why... Here's some psuedo code that illustrates the situation I'm in:
Code:
class Base
{
virtual void doSomething();
}
class Derived : public Base
{
void doSomething();
}
int main()
{
Base* p;
List<Base*> list;
list.add(new Derived());
p = list.pop();
p->doSomething(); // For some reason this is calling Base::doSomething()
return 0;
}
Based on the above scenario, does anyone see why p->doSomething() calls the Base method? Or any guesses as to what I'm doing wrong?