Home » C++ Function Overriding

C++ Function Overriding

by Online Tutorials Library

C++ Function Overriding

If derived class defines same function as defined in its base class, it is known as function overriding in C++. It is used to achieve runtime polymorphism. It enables you to provide specific implementation of the function which is already provided by its base class.

C++ Function Overriding Example

Let’s see a simple example of Function overriding in C++. In this example, we are overriding the eat() function.

Output:

Eating bread... 

You may also like