Taking the concepts that we have seen here, encapsulation becomes clearer. Basically, encapsulation means that an object is a self contained unit. It contains data, in the form of properties (also called instance variables), and methods associated with it to perform whatever actions the object needs to do what it needs to do.
We saw this with the Light class of objects.
We can also create a Customer class if we wanted to and associate data and methods with it that encapsulate customer information and actions within.
A customer object's data would be such items as Name, Address, Phone Number, Credit Limit, etc. Methods associated with the object could be actions related to displaying customer data, allowing the user to edit/add customers, printing a customer, etc. If you develop naming conventions for your object methods, using the objects become a breeze. The following example will use two mythical classes, customer and invoice. Note how the code, at this level, can be exceedingly similar. In fact, using OOP, the developer who takes objects and puts them together in the form of a system, will have a much easier job.
oCust = CREATEOBJECT("Customer") oCust.Display && Show the customer oCust.Edit && Edit the Customer oCust.Save && Save Customer oCust.Print && Print the customer oInv = CREATEOBJECT("Invoice") oInv.Display && Show the Invoice oInv.Edit && Edit the Invoice oInv.Save && Save Invoice oInv.Print && Print the Invoice