Hello

It seems I misunderstood some concept of classes in Pharo. My problem is
following:
Let's say I have class named SomeClass (subclass of Object) and class named
SubClass (subclass of SomeClass).

If I create instance variable on SomeClass and SomeClass>>#initialize which
initializes the variable, it gets initialized also when SubClass instance is
created.

Now I'm trying to do something similar for class-side variables, but with no
success.
If I create class-side variable on SomeClass and SomeClass
class>>#initialize which initializes the variable, it gets initialized only
in SomeClass class, but not in SubClass class.

What I mean:

Object subclass: #SomeClass

 SomeClass class
         instanceVariableNames: 'Ok'

 SomeClass class>>#initialize
        super initialize.
        Ok := true

 SomeClass class>>#isOk
        ^ Ok

SomeClass subclass: #SubClass

calling "SomeClass isOk" returns true.
calling "SubClass isOk" returns nil.


now If I create method

 SubClass class>>#initialize
        super initialize.

SubClass initializes as I would expect from my experience with instance
initialization, so "SubClass isOk" now returns true.


I will appreciate any help.

Jan



--
View this message in context: 
http://forum.world.st/class-initialization-and-class-side-variables-tp4822869.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to