[Solved] Why doesn’t “return x.a;” signal an error? [duplicate]


but I don’t understand why “return x.a;” doesn’t signal an error

return x.a is valid because x is accessible as a local variable inside the static method and is an instance of A. a is an instance property on the instance of A so x.a is perfectly valid.

solved Why doesn’t “return x.a;” signal an error? [duplicate]