[Tutor] [Slightly OT] Inheritance, Polymorphism and Encapsulation

Stephen Nelson-Smith sanelson at gmail.com
Wed Sep 19 02:09:36 CEST 2007


Hello friends,

Over lunch today some colleagues discussed a question they are using
as a conversation starter in some preliminary chats in our developer
hiring process.

The question was:

"Place the following three in order: Inheritance, Polymorphism, Encapsulation."

They specifically did not define in *what* order, leaving that for
the answerer to decide.

I responded thus:

Encapsulation comes with OO - you get it for free.  Polymorphism is a
hugely important enabler, but this in itself is enabled by
Inheritance, so I put them in this order: Inheritance, Polymorphism,
Encapsulation.

My colleagues felt that of the three options this was the least
satisfactory, and showed a lack of understanding of OO design.  One
even suggested that one could have polymorphism without inheritance.

I'm curious as to your opinions - answer to the question, responses to
my answer, and to the feedback from my colleagues.

Thanks!

S.


More information about the Tutor mailing list