Encapsulation


Enables you to control the access to data within a class
Not allowing direct access to certain methods and hiding the logic used in the class.


You can hide the implementation of a class by using access modifies that prevent code outside the class from modifying data within the class or calling its methods.



Access Modifiers

You declare a class using the Class Keyword
[attributes][access-modifier]Class identifier
[inherits classname]
{class body}
End Class


Keeping each type or class discreet and self contained.
Each class should be fully encapsulated, that is, it should define the state and responsibilities of that type.
For example, if you create an Employee object, that Employee object should fully define all there is to know about each Employee.
This allows you to change the implementation of one class without affecting any other classes.
This is achieved by making a clear distinction between the public interface of the class and its private implementation
A client can rely on a public interface not to be changed.



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext