Overriding a method is
to change the behavior of the method for the derived class.
Overriding is done
using inheritance and virtual functions.
To explain the concept
of overriding I have created two classes Poly
and abc(inherits poly).
public class poly
//these two functions, sum(), are overloaded.
public int sum(int x, int y)
return (x + y);
public virtual int sum(int x, int y, int z)
return (x + y + z);
public class abc : poly
//overriding function sum(), of base class poly
public override int sum(int x, int y, int z)
return (x + y + z + 10);