9.5 Access Functions and Utility Functions

Access Functions

Access functions can read or display data, not modify it. Another common use of access functions is to test the truth or falsity of conditions—such functions are often called predicate functions. An example would be an empty function for any container class—a class capable of holding many objects, such as an array or a vector. A program might test empty before attempting to read another item from the container object.2

Utility Functions

A utility function (also called a helper function) is a private member function ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.