A virtual function is a member function in the base class that we expect to redefine in derived classes.For example,class Base { public: void print() { // code } }; class Derived : public Base { public: void print() { // code } };...
The compiler first looks for thedisplay()function in classC. Since thefunctiondoesn't exist there, it looks for the function in classB(asCis derived fromB). The function also doesn't exist in classB, so the compiler looks for it in classA(asBis derived fromA). Ifdisplay()function exists...