
I looked up the difference between polymorphism and overloading (speaking of all languages in general), and apparently polymorphism is a general term for an operation that can accept arguments of different types. Overloading is a form of "ad-hoc polymorphism" in which the compiler chooses specific code to be executed by inspecting the arguments at compile time. Apparently "true polymorphism" means exactly the same code is executed no matter what the argument types, such as implemented by inheritance in C++ (*) Now my understanding of Haskell's classes is that the compiler chooses the right instance of the class at compile time. Does that mean that Haskell implements only ad-hoc polymorphism? (*) Another question: if someone says "What feature of C++ makes polymorphism possible?" What is the correct answer? Inheritance? Virtual methods? Some combination? -D