Home > DeveloperSection > Interviews > What is Method Overriding?

Posted on    October-16-2010 12:00 AM

 C# C# 
Ratings:
 2 Answer(s)
  1278  View(s)
Rate this:

Pushpendra Singh

Total Post:241

Points:1205
Posted on    November-01-2010 12:00 AM

Method Overriding is achieved when a subclass overrides non-static methods defined in the superclass, following which the new method implementation in the subclass that is executed.
The new method definition must have the same method signature and return type.
Clas A
{
Virtual void sum (int a)
{
}

}

Class B:A
{
public overrid void sum (int a)
{

}
}

Chris S
Chris S

Total Post:23

Points:115
Posted on    November-10-2010 1:00 AM

Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in java.


Modified On Mar-21-2016 06:55:43 AM

Don't want to miss updates? Please click the below button!

Follow MindStick