Revisit
superDice class >> new
| inst |
inst := super new.
inst initialize.
^ inst
We execute the following expression: Dice new
Dice class >> new
| inst |
inst := super new.
inst initialize.
^ instinst?super?super new?Dice class >> new
| inst |
inst := super new.
inst initialize.
^ instsuper is not the superclassinst is not an instance of the superclassDice class >> new
| inst |
inst := super new.
inst initialize.
^ instDice newDice
Dice class >> new
| inst |
inst := super new.
inst initialize.
^ instsuper is the receiver: the class Dicenew in the superclass of the class Dice class (Pay attention not Dice)DiceDice and send it initialize and return it
super :)super is the receiver of the message and the method lookup starts in the superclass of the class containing the expressionImagine we have
A >> foo
^ super class == self class
What is the result of A new foo and why?
/