Variable shadowing occurs when an inner scope declares a name already used by an outer scope. The inner declaration hides the outer one, making assignments and computations easy to misread. section 9.1
Mistake: assigning a parameter to itself
In Listing 9.1, setRadius(double rad) contains rad = rad;. Both names refer to the parameter, so the Circle member never changes. The constructor uses the same naming pattern safely through its initializer, but the setter needs this->rad = rad or clearer names. Naming conventions and namespaces can reduce similar maintenance hazards.



