Whenever you receive question from interviewer as what is polymorphism in Oops? Then you should be ready to give the answer, which is freshers junction explains here.
What is Polymorphism?
In Oops, Polymorphism is one of main concept. Polymorphism name itself tells “many forms”. That is Poly means “Many” morphism means “forms”. So Polymorphism meaning in Oops “one name many forms”. Or Polymorphism can also define as “same operation may behave differently on different classes”.
Real Time Example for Polymorphism in .Net or Java or Oops:Real time example for polymorphism is “Door”, why mean we can use these doors for home, car, lift etc.
Types of Polymorphism:
In the polymorphism concept types of polymorphism is also very important. You should give answer this question very clearly, Let us see what are types in polymorphism.
In polymorphism there are two types,
They are Static polymorphism and Dynamic polymorphism. Now we can see detailed description of Static polymorphism and Dynamic polymorphism.
Static Polymorphism is also known as Compile time polymorphism, this Static Polymorphism have two types those are “Function Overloading and operator overloading”.
Example program for compile time polymorphism – Method overloading
Dynamic Polymorphism is also known as Run time polymorphism, in this Dynamic Polymorphism one more type is there that is “Virtual Function”.
Example program for run time polymorphism – Method overriding
Example for compile time Polymorphism is “Method Overloading”, The concept of Method Overloading is clearly explain in the Freshers Junction blog previous post. That is
“Method overloading – Example Program”
Example for Run time Polymorphism is “Method Overriding”, The concept of Method Overloading is clearly explain in the Freshers Junction blog previous post. That is
“Method overriding – Example Program”
Note: Press Ctrl+D to bookmark this page, Then it will be easy to review this page before going to interview
Follow us on Google+, we reach you more Effectively
If you have any queries about this concept comment here, Freshers junction clarifies your doubt within short period of time.
You may also search in Google about this concept “What is Polymorphism? Types of Polymorphism? Real Time Examples” as:
Freshers junction - Real time example of polymorphism, types of polymorphism, meaning of polymorphism, polymorphism example program, polymorphism types and real time example, polymorphism in oops, polymorphism examples, what is polymorphism, different types of polymorphism