N
N
netstalkerrr2015-10-18 20:24:06
OOP
netstalkerrr, 2015-10-18 20:24:06

What is your understanding of polymorphism?

I noticed an interesting point, how people explain what "Polymorphism" is. If everything is more or less the same with the rest of the OOP terms, then when explaining polymorphism, you rarely meet two people who would say the same thing in their own words (terms from the wiki do not count :)). I would like to hear your few words about what "Polymorphism" is after all.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Latyshev, 2015-10-18
@magalex

This is a mechanism that allows you to refer to different entities by the same name.
On the example of functions (polyformism by parameters):

int max( int, int );
double max( double, double);

On the example of classes (polyformism by types):
class Animal{}
class Dog : public Animal {}
class Cat : public Animal {}
Animal* animal1 = new Dog();
Animal* animal2 = new Cat();

S
Shetani, 2015-10-18
@Shetani

There was a similar question recently.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question