Reputation: 167
The concept of public and private variables is called visibility.
I'm looking for a concise word that describes the difference between static attributes and instance attributes. Is scope fitting?
Upvotes: 4
Views: 67
Reputation: 16172
I think that "ownership" or "relationship" fits better, also the meaning can be somewhat different in different languages.
For example, in Python there are three types of such ownership:
In C++ instance attributes / methods are owned by the instance and static attributes are logically related to the class. We just use the class name as an additional namespace to refer to the static attributes or methods.
In php static attributes are similar to C++, but there is also is also late static binding which affects how static methods work with inheritance. So it depends on the usage - static methods are either just "related" to the class or "owned" by the class (when the late static binding is used).
Regarding the "scope" term - I think it doesn't fit because it is used to describe how the compiler / interpreter finds the meaning of the specific name in the specific context.
For example, if you have global variable x
and local with same name inside the function, the scope defines which of these two variables will be used.
Upvotes: 1