Access functions are utilized to give the applications programmer access to the individual components of the private data items of a class.
For example, if the private data of a class of 3-dimensional vectors contained
then access functions could be provided in the interface as
in which case they would be compiled as inline or as
in the implementation.
Note that the routines are all declared const which implies that the routine will not modify any of the objects data members. This also insures that the compiler will log an error if any of these are used on the left-hand side of an assignment statement, or passed to a routine through a non-const parameter.
This document maintained by Ken Joy.
Comments to the author : email@example.com
All contents copyright (c) 1998
Computer Science Department, University of California, Davis
All rights reserved.