previous | start | next

## Polymorphism (Syntax 11.3 Virtual Function Definition)

Syntax 11.3 : Virtual Function Definition
    class Class_name
    {
       virtual return_type function_name(parameter1, parameter2, ..., parametern);   . . .
    };
Example: |
    class Employee
    {
    public:
       virtual double get_salary();
       . . .
    };
Purpose: | Define a dynamically bound function that can be redefined in derived classes. When the function is called, the actual type of the implicit parameter determines which version of the function executes.

previous | start | next