-
Book Overview & Buying
-
Table Of Contents
Android Programming for Beginners - Fourth Edition
By :
Encapsulation means keeping the internal workings of your class code safe from interference from the code that uses it, by allowing only the variables and functions you choose to be accessed.
Encapsulation means that, done correctly, your class can be updated, extended, and improved without affecting the programs that use it. Of course, there may be occasions when you want to change the way your class is accessed.
It's a bit like the manufacturer of a car getting rid of the wheels and making it an electrically powered hover car. If it still has a steering wheel, accelerator, and brake pedal, driving should not be too challenging.
When we use the classes of the Android API, we are doing so in the way the Android developers designed their classes to allow us to. The classes of the Android API are constantly evolving, but we can continue using them as before.
Some encapsulation is a part of our classes by default. This is because a class exists within its own scope. However...