how do i initialize class variables?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how do i initialize class variables?

Avi Cohen
hello,
can i initialize them like regulat object variable? if i do, doesn't it initalize the class variable at every object creation?


thanks

 
Reply | Threaded
Open this post in threaded view
|

Re: how do i initialize class variables?

Ang BeePeng
Hi,

You only need to initialize it once. Class variable wont be initialize at every object creation, but the variable might change, yes.

For example, if you have

Object subclass: #MyClass
        instanceVariableNames: ''
        classVariableNames: 'MyClassVar'
        poolDictionaries: ''
        category: ''

initialize
        MyClassVar := anObject

then, do this once

        "MyClass initialize"

Thanks.

Ang Beepeng
Reply | Threaded
Open this post in threaded view
|

Re: how do i initialize class variables?

Alex Schenkman
In reply to this post by Avi Cohen
Look at this thread: http://forum.world.st/Howto-initialize-class-variables-td1667813.html#a1667813


On Wed, May 12, 2010 at 14:04, Avi Cohen <[hidden email]> wrote:

hello,
can i initialize them like regulat object variable? if i do, doesn't it
initalize the class variable at every object creation?


thanks


--
View this message in context: http://forum.world.st/how-do-i-initialize-class-variables-tp2195922p2195922.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners