Archive

Posts Tagged ‘Promotion’

Refactorings for variable scope widening (Widen Scope)

January 24th, 2012 Comments off

The scope of a variable declaration determines its visibility to the rest of a program. Scopes can be member-level, class-level and nested, where an inner scope may re-declare the meaning of a variable from an outer scope.

When declared inside a member, the scope of the variable is the entire member after the variable declaration, including all nested code blocks. This means that the variable is available to use within the member but when control passes to another member, the variable is unavailable.

Read more…