Saturday, 25 June 2016

'IS A' vs. 'HAS A'


has-a
  • A composition relationship where one object "belongs to" another object and behaves according to the rules of ownership.

is-a 
  • A relationship between abstractions (e.g. types, classes), where one class A is a subclass of another class B

Favor Composition over inheritance

No comments:

Post a Comment

Note: only a member of this blog may post a comment.