Variable types in smalltalk

后端 未结 3 1609
太阳男子
太阳男子 2020-12-21 08:49

I need help understanding the usage and the difference of variables in Smalltalk. What is the difference and the usage of each variable in the given code below?

<         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-21 09:28

    variables are identifiers. A variable holds a reference to some object.

    instanceVariableNames: here x belongs to an instance of a class.

    classVariableNames: here Yy have a copy of the variable shared with all instances of all classes, and it can be static a variable. so x can have different values across different objects. But Yy can have only one value.

    poolDictionaries: are created in smallTalk to provide access to variables shared among a group of classes

    category 'helpme' is a collection of related classes, if you create your class without a category; the class gets created with a blank category.

    subclass has its own instanceVariableNames(zzz), also has the inheritance property.

提交回复
热议问题