- ad-hoc polymorphism: functions with same name but different parameter lists (i.e. function overloading).
- parametric polymorphism: generic data types, for example, template in C++, which just provides a general data type.
- subtype polymorphism: different class objects (classes should have inheritance relations) can be applied with the same interfaces. For example, the virtual functions in C++.
This is a blog for interview questions. The questions are primarily from certain web forums, BBS or books. The owner of this blog doesn't claim any copyright of those questions. The blog is established primarily to help the blog owner prepare job interviews.
Friday, June 17, 2011
Polymorphism
Polymorphism means different types of data can be handled with an uniform interface. The interface is the same, but the implementation can be different. There are three types of polymorphism:
Labels:
OOP,
programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment