[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: Exercises Up: More C++ Previous: Memory Allocation

Scope and Namespaces

scope is the part of the program where a name has a meaning. The more localised variables are the better. There's

It's possible for a local variable to mask a global variable of the same name. If, in a function that has a local variable i you want to access a global variable i, you can use ::i, but it's better to avoid such nameclashes in the first place.



 
next up previous contents
Next: Exercises Up: More C++ Previous: Memory Allocation
Tim Love
2001-07-05