The program will eventually be executed in memory, and the variable can be accessed only if it occupies a place in memory.
Static members of a class (variables and methods) belong to the class itself, which allocates memory when the class is loaded, can be accessed directly through the class name, and non-static members (variables and methods) are objects of the class, so memory is allocated only when the class's object is generated (an instance of the class is created) and then accessed through the object (instance)
Accessing its non-static members in a static member of a class is an error because a static member of the class already exists when the non-static member of the class does not exist, and accessing something that does not exist in memory is of course an error: Class ca{private:int A;//non-static members, Allocates memory when an instance of the class is created, different instances of the class correspond to different memory regions
Why can't I call a non-static member (property) in a static method (function) of a class?