×

Loading...

Polymorphism ----many faces

Polymorphysm means many faces.

Polymorphism occurs at two levels. 1) CLASS level; 2) METHOD LEVEL.

1) A Bird can be a Parrot, or a Swallow, or Crow...

2) All the Animals can move. A Horse can run. A Fish can swim. A Swan can fly. .... All the
Animals can move.
In C++, one needs declare move() method of the Animal class
to be virtual; In Java, there is no such requirement and one just needs override the move()
method in the subclass.

I did not get any difficultties in understanding polymorphism, because I studied "Thinking in
Java" and "Thinking in C++".
If anybody feels confused about polymorphism, I sugget lokking into Bruce Eckel's book. Some
people criticise Bruce's book and say Bruce's book has no depth. I don't care. I just need a book
that is correct and easy to understand.
Report