Function Overriding:
Redefining a base class
function in the derived class to have our own implementation is referred as
overriding.
The signature of the
function will be same.
For example:-
Class m
{
public:
void display()
{
cout<<”Base class function”;
}
};
class n:public m
{
public:
void display()
{
vout<<”Derived class
function”;
}
};
void main()
{
n obj;
obj.display();
obj.show();
obj.m::display();
getch();
}
0 comments:
Post a Comment