In this post, we will see how to resolve Static Method accessing Static variable
Question:
Best Answer:
Inside yourfunctionA
you defining a local variable y:y
, which still has the value 0 and it is accessed from the static method functionZ
.To emphasize you want to access the static variable y rather than the local variable y, use the qualified identifier
Practice.y
.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review