Can a C++ class member function's argument have the same identifier (name) as a member data of the same class?
My method for dealing with this was to use the this
pointer, however I am not sure the code will compile as expected;
For example:
class M {
[public/private:]
int i;
void add(int i)
{
(this->i) = ((this->i) + i);
return;
}
}
Quite a strange example, but it demonstrates the principle. Are the parentheses required?