Home > DeveloperSection > Forums > How many types of encapsulation in OOP concept?
Royce Roy
Royce Roy

Total Post:149

Posted on    June-12-2013 1:18 AM


 1 Reply(s)
 2416  View(s)
Rate this:

What are the different types of encapsulation?

Am I right in thinking this basically refers to central OOP concepts such as Abstraction, Polymorphism and Inheritance?

My understanding of encapsulation is that it is a method of hiding data / functionality, but I never really considered Polymorphism or Inheritance a form of encapsulation, although I can see how polymorphism could be considered encapsulation as it can hide the exact type of the object you are interacting with.

So, would you say that's about it, or am I missing some core concepts?

edit I just noticed in the comments someone mentioned it could refer to private / public methods, perhaps I'm thinking in to the question too much and expecting a more complicated answer than it really is?

Vijay Shukla

Total Post:100

Posted on    June-12-2013 8:02 AM

Hello Royce Roy!
Encapsulation is defined by the International Organisation for Standardization's International Standard: "Information technology – Open Distributed Processing," ISO/IEC 10746, 1998.

It's defined in terms of more primitive definitions:

Entity: Any concrete or abstract thing of interest.

Object: A model of an entity. An object is characterised by its behaviour and, dually, by its state.

Behaviour (of an object): A collection of actions with a set of constraints on when they may occur.

Interface: An abstraction of the behaviour of an object that consists of a subset of the interactions of that object together with a set of constraints on when they may occur.

Encapsulation: the property that the information contained in an object is accessible only through interactions at the interfaces supported by the object.

The ISO does not define different types of encapsulation.

Read this link to more knowledge for Encapsulation

Don't want to miss updates? Please click the below button!

Follow MindStick