Tuesday, April 22, 2008

OOP Definitions

Just for my own benefit really, I wanted to put the definitions down in my own words.

The 3 tenets (pillars?) of OOP are: Encapsulation, Inheritance & Polymorphism.

  • Encapsulation: instance variables can only be accessed by instance methods.  Objects cannot get directly at the internal data of other objects.
  • Inheritance: Sub-classes can inherit the behaviours of super-classes (and extend them).
  • Polymorphism: An object can send the same message (call the same method) on different objects.  It doesn't matter whether the methods perform vastly different actions; the interface is the same.

Have I grossly over-simplified?  Any other suggestions?  What about Abstraction?  Is that covered by Encapsulation or not?

No comments:

Post a Comment