This week, we finally learned how to keep the NSA's prying eyes from our precious program data, with the use of the Encapsulation method. This coding technique virtually "encapsulates" the data you choose, as to prevent other parts of a program, or even the outside world, from accessing and changing the data.
This can be useful for keeping certain data types constant, while allowing certain subsets within it to be changed. The same can be done with "viewing rights," as you can designate which class and objects can be seen or not seen by the public. In the example below, the data class "myAccount" is visible to the public, as well as the account # associated with it. If set to "private" instead, only the class will be visible, not the #. This has many real world applications, especially in the financial industry.
No comments:
Post a Comment