classes and encapsulation

Encapsulation refers to the design concept that each object carries its own data and provides a set of services that are involved in calling the objects methods. objects provide services by sending and receiving messages from other objects. encapsulation means users can access an object’s services and functionality, without having ready access to the object’s underlying data itself. encapsulation facilitates software design and development using a ‘block method’ as well as object reuse, information hiding, and control over each object’s ability to view other objects.

classes facilitate the encapsulation process, by defining object program logic and data fields. essentially, classes definitions describe the structure of executing objects ~ that is, they act as templates for the creation of new instances (known in the jargon as ‘instantiation’ ) of the class object. methods that exist at the object level, as opposed to the instance level, can access the data of all object instances in the class. methods that exist at the level of an object’s instance can only access that particular data. the goal of object-oriented programing becomes achieving a balance between the degree of linkages among the various classes of any program and the degree of consistency within each individual class.

No Comment

No comments yet

Leave a reply