Class variables (scope, meaning, example)?

Hello,

Could someone explain to me the scope of class variables using an example and what their purpose is?
Unfortunately I don't understand the concept of class variables, it would be nice if someone could explain this to me.

Thanks in advance!

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
1 Answer
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Destranix
2 years ago

Imagine that you have an extra class object for each class that exists only once per class and that all instances of the class and the extra class object itself have access to.
You essentially divide your class into a class part and an instance part. The class part only exists once, and the instance part exists per instance.

That would be it in general. For anything more specific, you would have to look at a special language and specific cases.