Polymorphism is the ability to create a variable, a function, or an object that has more than one form.
Drive Slowely
Types Of Polymorphism:-
- 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.
- 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