Overloading

Also known as Compile Time Polymorphism

 

Allows the use of the same method name, as long as its signature is different.

 

The signature consists of the method name and a parameter list.

 

e.g.

add(int a, int b)

Vs

add(double a, double b)

 

Therefore by providing different parameters (as in the number of parameters or types of parameters), we can use the same method name: this is known as method overloading.

 

Method overriding means having a different implementation of the same method in the inherited class. The Parent and the Child methods have the same signature, but different implementation, as per above.

Leave a Reply