Jesper de Jong wrote:
stewart ie wrote:Inheritance is something you are (you inherit your appearance from your parents), ...
Inheritance is the concept of children inheriting common traits from their parents.
Using the example we have above:
Both recruiters and managers are employees. Employee is their "parent".
One thing to be careful with, with regard to the concept of inheritance, is not to confuse the meaning of inheritance in biology with object oriented programming.
Too often people are talking about "parent classes" and "child classes", and comparing inheritance in programming to biological inheritance (inheriting traits from your parents).
This can be confusing, because inheritance in programming really does not mean the same thing as inheritance in biology.
In object oriented programming, inheritance means: specialization.
stewart ie wrote:To remember it I always thought about it like this: "A manager IS AN employee"
That's a much better way of thinking about inheritance in programming. There is indeed an "is a" relationship between a subclass and it's superclass; an instance of a subclass is a (special kind of) an instance of its superclass. So, a manager is a special kind of employee. It inherits the traits of its superclass Employee, and adds / implements these traits in a way that is specific for managers.
Note that in biology, inheritance does not mean specialization. A Child is not a Parent; I am not a specialized version of my father.