Content deleted Content added
No edit summary |
→Name masking: Disambiguated and clarified the code example greatly. |
||
Line 39:
The outer variable X is said to be ''shadowed'' by the inner variable X'.
For example, the parameter
<source lang=java>
private int foo; //
public void setFoo(int foo) { // Name "foo" is
this.foo = foo;
}
public int getFoo() { return foo; }▼
</source>▼
return foo;
}
▲</source>
Name masking can cause [[Function overloading#Complications|complications in function overloading]], due to overloading not happening across scopes in some languages, notably C++, thus requiring all overloaded functions to be redeclared or explicitly imported into a given namespace.
|