Explain Function overriding With Example and Program In C++
Function overriding:
When the same function exists in both the base class and the derived class, the function in the derived class will be executed.
(This is true of objects of the derived class. Objects of the base class don’t know anything about the derived class and will always use the base class functions.)
We say that the derived class function overrides the base class function. This is called the function overriding. This overriding is avoided by virtual function to achieve run time polymorphism.
Labels: C++