What is polymorphism? Explain with an example.

Answer Posted / amit kumar

Poly means “many” and morph means “form”. In the context of
object-oriented systems, it means objects that can take on
or assume many different forms. Polymorphism means that the
same operation may behave differently on different classes.

Polymorphism allows us to write generic, reusable code more
easily, because we can specify general instructions and
delegate the implementation details to the objects involved.
Since no assumption is made about the class of an object
that receives a message, fewer dependencies are needed in
the code and, therefore maintenance is easier. For example,
in a payroll system, manager, office worker, and production
worker objects all will respond to the compute payroll
message, but the actual operations performed are object specific

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you define a class in oop?

628


What is oops and its features?

590


Why is oop useful?

602


What is difference between polymorphism and inheritance?

618


Is html an oop?

584






What is the purpose of polymorphism?

683


What is abstraction in oop with example?

646


Why polymorphism is used in oops?

585


Why is encapsulation used?

577


Which language is pure oop?

551


What is the point of polymorphism?

590


What is class encapsulation?

597


Write a c++ program to display pass and fail for three student using static member function

2818


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4244


Why do we use inheritance?

630