Sunday, June 22, 2014

Polymorphism

Polymorphism is the ability to create a variable, a function, or an object that has more than one form.

Types Of Polymorphism:-

  1. Compile time polymorphism (object is bound with its functionality at compile time) We can achieve compile time polymorphism by using function overloading and operator overloading.  Java does not support compile time binding.
  2. Run time Polymorphism (object is bounded with its functionality at run time) We can achieve runtime polymorphism by using function overriding.

Example of Run Time Polymorphism:-

Output:-
Drive Slowely

No comments:

Post a Comment