Scope of an instance variable
The scope of an instance variable (public or private) includes all of the code in all of the instance functions (non-static functions) that are defined in the same class.
Static functions do not have direct access to instance variables. Static functions only have access to other static members of the class (variables and functions).
When objects are instantiated in dynamic memory, public instance variables are accessible to any code anywhere in the program that has access to a pointer variable containing the address of the object in dynamic memory.