3.9 SCOPE RULES

Scope rules specify the part of program (space) where a given variable is valid (for use in code). Local variable of a function is valid only from the place of declaration until the end of that function. Global variable is valid from the place of declaration until the end of the file. A reference to a variable outside its scope results in compilation error.

Get Object Oriented Programming with C++, Second Edition 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.