Members vs method arguments access in C++
问题 Can I have a method which takes arguments that are denoted with the same names as the members of the holding class? I tried to use this: class Foo { public: int x, y; void set_values(int x, int y) { x = x; y = y; }; }; ... but it doesn't seem to work. Is there any way of accessing the the instance the namespace of which I'm working in, similar to JavaScript's this or Python's self ? 回答1: It's generally a good idea to avoid this kind of confusion by using a naming convention for member