Function Overriding in C++

In a C++ programming language, it the base and derived both class has a function with same name and same parameter then derived class overrides the base class definition.

Such function’s are called overridden function and this process is called function overriding.   

Output

Note: In the above program, class A & B both has a function (show ()) with same name and same parameter list.

When we call a show () function of base class A then show () function of derived class overrides the show () function of base class.