Thursday 3 May 2018

What is polymorphism?

Purpose:
  • It is likely that interviewers will ask basic object orientation questions just to test whether someone has a solid grasps of the principles behind the the languages.
  • Not being able to answer these questions are massive red flags surrounding a developer's education and grasp of the programming domain.
  • Interesting it is surprising how many developers at all levels get this question completely wrong.

Potential Answer:
In programming languages, polymorphism is the provision of a single interface to entities of different types. A polymorphic type is one whose operations can also be applied to values of some other type, or types. Put simply it is classes that share the same interface but have different functionality.

Another approach would be to talk about behavior being determined at runtime for a particular method signature.

Example used by John: DVD and Blue-ray use same interface but are implemented differently under the hood. This deferred execution based on context is polymorphism.


No comments:

Post a Comment