- Ability to identify a function to run.
- One name many forms.(some object/function behaving as many forms)
- Also called method and operator overloading.
- Method with same name,but different signature,signature means:
- No. of parameters
- Type of parameters
- Order of parameters
2)Run-time(Overriding)
- Method of base class is re-defined in the derived class.
- Method with same name,same signature and exactly the same return type.
INHERITANCE
- Child class allows to inherit properties from its parent class(extends keyword).
- Access only public/protected.
Multiple inheritance
- Child class inherit properties from multiple classes.
- Java does not allow extend multiple classes.
- Problem with multiple inheritance:
If multiple parents have methods with same name,then at run at run time difficult to decide for the compiler,which method to execute.
- To overcome this problem,Java allows to implement multiple interfaces.