Which version of the function to be called is based upon the type of object pointed by the pointer.This determination of call is made at run time.As your question says the pointer is pointed to the derived object.So the call will be based upon the object pointed and in ur case it is the derived class function.
Execute the following programm and you will be clear.
#include<iostream>
#include<conio.h>
using namespace std;
class base
{
public:
virtual void display()
{
cout<<"display function in base class"<<endl;
}
};
class derived:public base
{
public:
void display()
{
cout<<"dislay function in derived class"<<endl;
}
};
int main()
{
base *bptr;
derived d1;
bptr &d1;
bptr->display();
getch();
return 0;
}
ans:;dislay function in derived class