Method Overriding in C#.NET

Method Overriding in C#.NET

Creating a method in derived class with same signature as a method in base class is called as method overriding.

Same signature means methods must have same name, same number of arguments and same type of arguments.

Method overriding is possible only in derived classes, but not within the same class.

When derived class needs a method with same signature as in base class, but wants to execute different code than provided by base class then method overriding will be used.

To allow the derived class to override a method of the base class, C# provides two options, virtual methods and abstract methods.



Comments

Popular posts from this blog

SharePoint 2007 - Simple Task Dashboard

MERGE transformation in SSIS