Function Overriding
Function Overriding
Giving new implementation of base class method into derived class is called function overriding.
Signature of base class method and derived class must be same. Signature involves:
Number of arguments
Type of arguments
Sequence of arguments
#include<iostream.h>
#include<conio.h>
class BaseClass
{
public:
void Display()
{
cout<<"\n\tThis is Display() method of BaseClass";
}
void Show()
{
cout<<"\n\tThis is Show() method of BaseClass";
}
};
public:
};
void main()
{
DerivedClass Dr;
Dr.Display();
Dr.Show();
}
Output :