Polymorphism ----many faces

jabber (jabber)
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.

2000-11-29 -04:00

回到话题: Jabber, HH, and how are you: let me try to say something about Polymorphism, Interface and Inner class, please give me your comments. Thanks.

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论