Encapsulation is a system to bind code and data together. By using this process we can keep both data and code safe. Here we can easily avoid meddling and misuse of data and code. In short we can say that we can separate some particular code and data from the other code and data by using' this encapsulation. In other words we can say that encapsulation can hide the functional details of a particular class from the objects that are used to send messages to it. In the above section we have described a class, i. e. Jack and the associated method, sleep(). The code for the sleep() method defines all the details of the method (how Jack sleeps, etc). When encapsu lated, this information cannot be revealed to others. We can protect
this information from other classes by using the system of encapsu lation. By using this system we can easily edit our web pages where the clients status will not be changed as some certain data will always be hidden and protected from the clients.
![]()



Reply With Quote
Bookmarks