Elimination of Name Conflicts
Class opening and closing braces (and the closing semicolon) form the class scope pretty much in the same way as an ordinary structure forms a separate scope for its fields. This class scope, which is nested within the file scope, is similar to the scope of an ordinary structure. The difference is that the class scope can nest function scopes.
Nonmember functions (e.g., access functions in Listing 9.1) are global functions, and their names must be unique in the program (unless they are made static in the file scope, but only a small minority of functions can be made static in the file scope; more on static functions can be found in Chapter 6, "Memory Management. The Stack and The Heap," and later in this chapter). ...
Get Core C++ A Software Engineering Approach 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.