virtaul function
- by hitech
class a
{
virtual void foo(void) ;
};
class b : public a
{
public:
virtual void foo(void)
{
cout<< "class b";
}
};
int main ( )
{
class a *b_ptr = new b ;
b_ptr-foo();
}
please guide me why the b_ptr-foo() will not call the foo() function of the class b?