Named instance variables
Last updated at 7:26 pm UTC on 24 July 2018
Variables are defined in a class definition, a template follows:
Object subclass: #NameOfSubclass
Named instance variables may be referenced in
- instance methods of the defining class
- instance methods of any sub-classes of the defining class
- Named instance variables may not be overridden (no sub-class may redefine an existing Named instance variable name either by an instance variable name or class variable name.
- Class variable names may not be any of the Reserved identifiers (i.e., nil, true, false, self, super)
- Named instance variable names may start with either an upper case or lower case letter (although those starting with an upper case letter are likely to be confused with Class variables by the poor person that has to maintain your code).
- Named instance variables are initially set to nil by the default initialization methods (if you override the default methods their value may be undefined[un sure of this])
- Instance variables are also objects, as are classes. When inspecting an object, you can Blue button click on self or any instance variable and select "methods storing into this inst var".