Thursday 15 March 2012

Data Abstraction and Encapsulation

Data Abstraction:

The wrapping up of data and methods into a single unit (called class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to_the outside world and only those methods, which are wrapped in the class, can access it. These methods provide the interface between the object's data and the program. This insulation of the data from direct access by the program is called data hiding. Encapsulation makes it possible tor objects to be treated like 'black boxes', each performing a specific task without any concern for internal implementation

 



Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and cost, and methods that operate on these attributes. They encapsulate all the essential properties of the objects that are to be created.

No comments:

Post a Comment