Simple question:
Are static variable being class instance variable or class variable bases?
Knowing that class instance variable are variables that are define for each class and subclass where it is define.
And class variable are variables that are global to all subclass where it is define including itself.
EDIT: Knowing that I am choking a lot of C#-ish guy I am using the term class instance as if a class where an instance of some MetaClass. This simplify greatly my question. Although it is not totally wrong to say that if you consider that the VM certainly have an artifact that represent evrey class (containing the method dictionay, instance size, the superclass, …).
Thanks
They are class variables.
There is nothing like a Smalltalk class instance variable in C#. I.e. there isn’t a way to define a variable that is common across all the instances of a class, but which has different values for its subclasses.
To obtain a “similar” behaviour, but with the drawback that the class instance var is accessible only after having created an instance of your class I’ve done something like this: