DEV Community

Chhavi Joshi
Chhavi Joshi

Posted on • Edited on

Overriding

Overriding is a concept similar to that of method overloading, its just that method overriding takes place in inheritance and unlike method overloading where at least a parameter or return type must be different in both the methods having same name, in function overriding two functions of same name in different classes can be overridden such that their name, number of parameters, type of parameters and return type is also same.

Example:

Output:

Top comments (0)