Jos Timanta Tarigan <[EMAIL PROTECTED]> wrote:
> ...i have a method that require a parameter var1,
> and the name var1 already used by the global variable.

Parameter names will 'shadow' globals in function methods.
It's a matter of style, I prefer not to name parameters
the same as a global that I need to use.

> In java we can access both by using this.var1

That is not a parameter, but an instance member.

> for global variable and var1 for local variable. 
> 
> Is it possible to do the same in C++? How can I do it?

Use the scope resolution operator, e.g. ::var1, to
get the 'global' one.

-- 
Peter

Reply via email to