| Hyderabad Jobs | Book Website | ![]() |
I Love Hyderabad | Hyderabad Colleges |
| Home | Business Emails | Hyderabad Classifieds | Contact Us | |
| 7 Wonders of Hyderabad | Web Hosting | Yellow Pages | Our Network | |
Advanced PowerBuilder
EncapsulationEncapsulation is a process of hiding the internal workings of a object, to support or enforce abstraction. It also attempts to separate an object's interface from its underlying implementation. Methods ( object's interface ) are the services that are provided for other objects to interact with this object. Methods operate on the data defined at the object level and are typically implemented by defining functions at the object level. Methods can take input and ( sometimes ) generate output. In simple terms, a method describes what an object can do, while the implementation describes how it does it. This distinction helps in hiding details of the data and complexity of the method implementation from other objects, by exposing only the relevant properties of an object; a user views an object in terms of the services it can perform, and not in terms of its data structure. For example, return to our idea of a drawing object. As you already know, you can define attributes as well as associated methods for the drawing object - in this case, these methods include the logic required to draw the object. By defining methods at the object level, an object can call a function draw() with a radius and a center point to draw a circle. Sometimes encapsulation is defined as the act of combining functions and data, but it is misleading. You can join functions and data together in a class and make the members public, but that is not an example of encapsulation. A truly encapsulated class "surrounds" or hides its data with its functions, so that, you can access the data only by calling functions.
One of the advantages of this 'method hiding' is the logic maintenance. As long as you leave the message syntax alone, you can alter the contents of the method without needing to alter any references to the draw() function throughout the application. Benefits of EncapsulationThe benefit of encapsulation is to guarantee that an object satisfies application-defined integrity constraints.
|
| Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com |