5Data Sharing and Protecting

An important characteristic of C++ is that it is a language in which it is suitable to write large complex programs and enables data sharing and protection mechanisms. In this chapter we will introduce the concept of scope, visibility, and the lifetime of identifiers, as well as the sharing and protection mechanism of class members. At last we will introduce the multifile structure and compilation preprocessing directives, that is, how to use several source files to organize large programs.

5.1Scope and Visibility of Identifiers

Scope concerns the effective range of an identifier, while visibility concerns whether an identifier can be referenced. We know that a variable declared in a function can only be effective ...

Get C++ Programming 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.