Virtual Function
Virtual Function
Virtual function is a function, whose functionality can be over-ridden in its derived classes. Virtual function is a member function of a class. In derived class the whole function body can be replaced with a new set of implementations.
Properties:
• Virtual function is a member function of a class
• Virtual function is declared having virtual keyword preceding the function name.
• The functionality of virtual function in the derived class is different.
• function calls are resolved at run-time.
The basic difference between a function and a virtual function is that normal functions are resolved at compile time, while the virtual functions are resolved at run-time.
Posted in Computer Science, Information Technology, Object Oriented Programming, Object Oriented Programming |
