Object-Oriented Terminology – What is a Polymorphic Method?

object-orientedterminology

Sometimes people use the phrase "Polymorphic method/function".

Does it mean:

  1. A method that takes a Polymorphic type as a parameter, and performs some operation on it. By "Polymorphic type" I mean a super-type with multiple sub-types.
  2. An abstract or virtual method in a super-type, with multiple sub-types that implement/override the method differently.

Best Answer

The therm "polymorphic", alone, means nothing more that "a noun or verb that can act differently depending on context".

You say "do" and something gets done. What is actually done ... depend on the something.

How this translated into programming depends on the chosen language, its features and the way you use those features to manipulate things.

Even C (that's not normally thought as an OOP language) can use a statement like a.(*do)() to do different things depending on a...

Related Topic