Computer Science, asked by chhotelalsah895, 2 months ago

What is polymorphism? Explain using an example.​

Answers

Answered by Xennial
25

\huge\boxed{\displaystyle \rm\green{❥Answer}}

Polymorphism :-

  • Polymorphism is an object-oriented programming concept.
  • It refers to the ability of a variable, function or object to take on multiple forms.
  • In a programming language exhibiting polymorphism, class objects belonging to the same hierarchical tree (inherited from a common parent class) may have functions with the same name, but with different behaviors.

Examples :-

The classic example is of the Shape class and all the classes that are inherited from it, such as:

  • Rectangle

  • Triangle

  • Circle
Answered by noohusmanrandera
3

Answer:

Polymorphism :-

Polymorphism is an object-oriented programming concept.

It refers to the ability of a variable, function or object to take on multiple forms.

In a programming language exhibiting polymorphism, class objects belonging to the same hierarchical tree (inherited from a common parent class) may have functions with the same name, but with different behaviors.

Examples :-

The classic example is of the Shape class and all the classes that are inherited from it, such as:

Rectangle

Triangle

Circle

Similar questions
Math, 1 month ago