Anonymous

What Is Meant By Overriding?

2 Answers

ghazal gi Profile
ghazal gi answered
The method overriding is a technique used in object oriented programming, it is a language feature in which we can use the same name of a method many times but in different classes not in the same class. It means that the same function name can only be used in different classes.

The name of a method is already used in the superclass then you can also use that name for the other method in the subclass via the method overriding the method in the superclass can be written again in the subclass. The implementation in the subclass overrides (replaces) the implementation in the superclass.

Subclass can have the same name like the superclass name and should also acquire the same parameters like in the superclass. The return types of the methods should also be the same just like the parameters of the overridden function should be same.

Method overriding is an important and carry flexible feature that is used in many object oriented programs which is mostly known by the polymorphisms technique.

Some of the languages don't allow the programmer to use the method overriding technique in their some portions or in some main parts of the programs.

The abstract superclass have a common interface which all the subclasses inherit.
saiful islam Profile
saiful islam answered
Overriding is the action of modifying or replacing the implementation of the parent class with a new one. Parent classes with virtual or abstract members allow derived classes to override them.

Answer Question

Anonymous