C++ Virtual Function

tutorial and example
tutorial and example

virtual function is such function which is declared inside base class and redefined by derive class. C++ uses virtual keyword to make a function as virtual function. The virtual function is always define in base class.

The concept of polymorphism is also achieved using virtual function. If two functions with same name present in base and derive class then the pointer of the base class would call the functions associated only with the base class

C++ Virtual Function Example