Method Overriding:
Method overriding isthe mechanism same method name with same arguments and return types associatedin a class and its subclass. Overriding is mainly used in functions.
Only those methods are override that methods are declaredwith keyword virtual in the base class.
Example:
Class A
{
Virtual void add(int a, int b)
{
Return(a+b);
}
}
Class B:A
{
Public override void mul(int a, int b)
{
Return(a*b);
}
}
Static void main()
{
A obj=new A()
Obj.add(5,6);
B obj1=new B();
Obj.mul(5,9):
}