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.
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) {
} }
Liked By
Write Answer
What is Method Overriding?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
10-Nov-2010Method 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.
Pushpendra Singh
01-Nov-2010The 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)
{
}
}