Encapsulation

Private implementation behind public interface

Example:

  • Car engine is an implementation which is ‘hidden’ behind public interface made up of steering wheel, clutch, gear-knob, brakes, accelerator and key.
  • In a restaurant, waiter is public interface which hides kitchen & chefs – an implementation.
  • Computer IO (Display, mouse, keypad, touchpad) is an interface while mother-board, processor, RAM etc. are implementation.
  • RSS
  • Print
  • PDF
  • Twitter
  • del.icio.us
  • Facebook
  • LinkedIn
  • Google Bookmarks
  • Digg
  • Add to favorites
  • StumbleUpon

Comments 6

  1. jocel myrton wrote:

    nice.. hope i can use it to my upcomming programs

    Posted 15 Jun 2011 at 7:02 am
  2. ?JAKIR! wrote:

    good
    how to use it in programming?

    Posted 20 Jun 2011 at 5:29 am
  3. ?JAKIR! wrote:

    Thank you sir

    Posted 20 Jun 2011 at 5:32 am
  4. Akib wrote:

    Thank you to give Example.

    Posted 17 Aug 2011 at 12:28 pm
  5. fail wrote:

    steering wheel, clutch, gear-knob and brakes do not interact with the engine and the key only interacts with the starter motor

    Posted 25 Aug 2011 at 2:34 pm
  6. Chetan wrote:

    You are very right. Still, engine is controlled via such interface. Engine is complicated and contains many parts controlled by many parts other than engine. But it is all encapsulated behind simple interface of steering wheel, clutch etc. Car driver needs to know about such public interface only for purpose of driving and nothing else.

    Posted 25 Aug 2011 at 5:28 pm

Post a Comment

Your email is never published nor shared. Required fields are marked *