answersLogoWhite

0

What is meant by polymorphism?

Updated: 12/21/2022
User Avatar

Wiki User

15y ago

Best Answer

Polymorphism

Polymorphism allows the programmer to treat derived class members just like their parent class' members. More precisely, Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to method calls of methods of the same name, each one according to an appropriate type-specific behavior. One method, or an operator such as +, -, or *, can be abstractly applied in many different situations. If a Dog is commanded to speak(), this may elicit a bark(). However, if a Pig is commanded to speak(), this may elicit an oink(). They both inherit speak() from Animal, but their derived class methods override the methods of the parent class; this is Overriding Polymorphism. Overloading Polymorphism is the use of one method signature, or one operator such as "+", to perform several different functions depending on the implementation. The "+" operator, for example, may be used to perform integer addition, float addition, list concatenation, or string concatenation. Any two subclasses of Number, such as Integer and Double, are expected to add together properly in an OOP language. The language must therefore overload the addition operator, "+", to work this way. This helps improve code readability. How this is implemented varies from language to language, but most OOP languages support at least some level of overloading polymorphism. Many OOP languages also support Parametric Polymorphism, where code is written without mention of any specific type and thus can be used transparently with any number of new types. Pointers are an example of a simple polymorphic routine that can be used with many different types of objects.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is meant by polymorphism?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What do you meant by Runtime Polymorphism?

Runtime polymorphism is also called as method overriding, late binding or dynamic polymorphism. It is when a method in a subclass overrides a method in its super class with the same name and signature.


Polymorphism in coelentrates?

polymorphism in coelentrates


What is polymorphism and its types?

Polymorphism means multiple form of a function, variable or object. In Computer Science, polymorphism is a programming language feature that allows values of different data types to be handles using a common interface. There are three types : Ad-Hoc Polymosphism, Parametric Polymorphism, Subtype/Inclusion Polymorphism. Source: Wikipedia.


What kind of drugs commonly has polymorphism?

Polymorphism is common with barbiturates, steroids, and sulphonamides.


Is polymorphism exist between prokaryotes?

Yes, polymorphism exists between the prokaryotes.


What is Difference between dynamic polymorphism and static polymorphism with example?

Static polymorphism is used the concept of early binding or we can say compile time binding where as dynamic polymorphism used the concept of late binding or run time binding.


How can one detect polymorphism by genetic marker?

One can detect polymorphism by genetic marker using single-nucleotide polymorphism which is able to even tell mutation of a gene.


Define compile time polymorphism with short examples?

compiler can decide which form of the object should be invoked during compile time.this type of polymorphism is know as compile time polymorphism


What is drug polymorphism?

Drug polymorphism is a customerÕs variation in response to a drug is by gender, body composition, size and age. The first polymorphism was first labelled over 40 years ago.


Is Interfaces in Java a kind of polymorphism?

No. Interfaces in Java are a construct to get polymorphism ( subtype polymorphism ) working in Java, but they are not a "kind" of polymorphism. In polymorphism happens when two objects respond to the same message ( method call ) in different way ( hence poly -> many, morphism -> way or shape : polymorphism -> many ways). In Java to be able to send the same message to two different objects you have to either inherit the same parent, or implement the same interface.


In what study would one find polymorphism?

Polymorphism is the changing of one subject to an altered state. There are actually two areas of study where polymorphism would be particularly common: chemistry and web programming.


How can be different forms of polymorphism achieved?

Implicit Parametric PolymorphismSubtype PolymorphismExplicit Parametric Polymorphism