what is polymorphism with example?types of polymorphism?
Answer Posted / hassan arafat
Polymorphism allows an entity (for example, variable,
function or object) to take a variety of representations.
Ad-hoc polymorphism: This polymorphism let a function to
have different implementations based on its parameters and
return type. Ad-hoc polymorphism is supported through
function and method overloading.
Parametric polymorphism: lets you write a piece of code
that is not associated with a particular type and therefore
can be used with any type. Object oriented languages like
C# achieve it through generics.
Inclusion polymorphism: let a type hold instances of many
different types as long as the types are related by some
common parent class. Object oriented languages like C#
achieve inclusion polymorphism through inheritance.
Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
Explain about strings in java?
Why should we use singleton pattern instead of static class?
Can you explain the usages of class.forname()?
when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???
Is there any case when finally will not be executed?
What are the types of strings?
What is assembly language?
Can a class declared as private be accessed outside it’s package?
What does those terms actually mean included in the j.d.k i.6?
What is the public method modifier?
which class is the wait() method defined in? : Java thread
What is the difference between delete and delete[]
Describe method overriding
How are java objects passed to a method and what are native methods?
How variables are stored in memory?