The compiler keeps saying 'class A' has no member named 'foo'. I am trying to use a function from a derived class with a pointer. Here is my code:
class A{ ..... }; class B:public A{ virtual void foo() = 0; }; class C:public B{ .... public: void foo(){ .... } }; I have a table of A pointers named Table and when trying
Table[j]->foo() I am getting the compiler error.
What should I do except cast?
A? That's the type you actually try to use polymorphically.B. It won't have it.