Variables in C++ are subject to two constraints. One is the rules of scope, and the other is access control. Encapsulation allows the programmer to control both the scope of names, and access to functions and/or values stored inside an object. The main construct is the class, which allows both variables and functions to be declared within it. These names are subject to visibility rules, and can be declared as having private, or public access.
Copyright © 2003 Roger Hartley