|
- Virtual functions are used with inheritance, they are called according to the type of object pointed or referred, not according to the type of pointer or reference.
- In other words, virtual functions are resolved late, at runtime. Virtual keyword is used to make a function virtual.
- C++ program with runtime polymorphism (use of virtual functions).
-
A base class and a derived class.
-
A function with same name in base class and derived class.
- A pointer or reference of base class type pointing or referring to an object of derived class.
|