+ 1

Polymorphism

May someone explain the whole concept of polymorphism

17th Jan 2017, 5:47 PM
Likoro Frederick
Likoro Frederick - avatar
1 Resposta
+ 3
I cannot explain the whole concept, but this may give you some clues. First of all, "polymorphism" comes from poly- (several, many) and -morph (form or figure), but you certainly knew that. Now take this (very simple) code: https://code.sololearn.com/cqCT5AC6NNAF/?ref=app A Dog is a subclass of an Animal, so every Dog is an Animal. But not every Animal is a Dog. So Dog can be interpreted both as a Dog and as an Animal, so you could say "it has two forms".
17th Jan 2017, 8:07 PM
Álvaro