8 ms·
> So if you're accessing a variable without [obj]. it's either a member of the current object, or it's a local variable in the current function. It could also
by tjalfi 6y ago
> So if you're accessing a variable without [obj]. it's either a member of the current object, or it's a local variable in the current function.
It could also be a field in the parent class. Protected fields are a bad idea but I’m sure some people use them.
- brundolf 6y agoA field in the parent class is still a member of the current object, and I'm pretty sure there's no way "this." could make a difference there, right?
- tjalfi 6y agoYou're correct that the presence or absence of a "this." shouldn't make a difference. Having said that, C# also permits you to have fields with the same name in both the parent class and the current object. This will give you a compiler warning suggesting you use the new keyword, though.
- deleted 6y ago[deleted]