Underscore makes a difference, but why?
in
Programming Questions
•
7 months ago
I've seen people using "_x" while calling variables inside a constructor. According to many answers online this does not matter but it appears to me that it does. If i were to simply name them x and y without the underscore. My object will later on not appear where i want it too. The only factor that makes it work is wether or not i call the variable in the constructor "_x". And the only logical reason i can think of is the fact that the constructor variables and the global variables share a name if i go without the underscore, and that's whats causing it not to work.(x = x; as opposed to x = _x;) Am i on the right track?
1