I know how virtual function is used to achieve RT polymorphism .By using base class reference and storing derived class object in it.And then calling the overridden method using this reference. But Is this also true?
class Base
{
public:
void show();
{
cout << "Base class\t";
}
};
class Derived:public Base
{
public:
void show()
{
cout << "Derived Class";
}
}
int main()
{
Base b; //Base class object
Derived d; //Derived class object
d.show(); // is this run time polymorphism??
}
//Output : Derived class