Why Use Encapsulation?


Some programmers may think encapsulation is simply a clever way to make your program orderly by putting related attributes and procedures under one roof. Although this is true, protection is the reason for encapsulation.

Previously you learned in this chapter that there is really no protection against the improper use of attributes and procedures in procedural programming. Both are available for a programmer to use without any checks and balances .

You might say that encapsulation enables a programmer to institute those checks and balances by placing attributes and procedures in a class and then defining rules in the class to control its access.




OOP Demystified
OOP Demystified
ISBN: 0072253630
EAN: 2147483647
Year: 2006
Pages: 130

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net