Public and Private class members

When you define a class, you can make members Public (so members can be referred to by statements outside the class definition) or Private (so members can be referred to only by properties and methods defined in that class). Member variables are Private by default; and properties, subs, and functions are Public by default.

It is good programming practice to keep class member variables Private, and to use Public properties and methods to manipulate the private data stored in member variables. Keeping member variables Private is often called data hiding or encapsulation because private data is hidden from subs and functions defined outside the class. Keeping properties and methods Public provides public access to the users of the class.