semtex
2011-01-31 10:05:10 UTC
Hello!
I've read the blue book (pages 61 to 66 for that matter) but i still
have some question concerning the method lookup:
Situation:
Class Workstation has its superclass Object,
myWorkstation is a instance of Workstation.
if i do "myWorkstation createRandomFile: 400" what happens (let's
assume createRandomFile is defined in Workstation)?
Method lookup starts at the class of the instance that was called and
leads all the way up till "Object" =>
In my case, it starts at Workstation and then goes up to Object (if
needed). createRandomFile will be found in Workstation and the code
will be executed. so far so good.
but HOW can the method be found there? I thought you need a method
dictionary for that... and Behavior supplies that method dictionary.
But Workstation has no "Behavior" in his direct class hierarchy,
"Workstation class" has (and Workstation is a instance of Workstation
class..)
I'd highly appreciate it if someone could help me with that matter!
Thanks,
Klaus
I've read the blue book (pages 61 to 66 for that matter) but i still
have some question concerning the method lookup:
Situation:
Class Workstation has its superclass Object,
myWorkstation is a instance of Workstation.
if i do "myWorkstation createRandomFile: 400" what happens (let's
assume createRandomFile is defined in Workstation)?
Method lookup starts at the class of the instance that was called and
leads all the way up till "Object" =>
In my case, it starts at Workstation and then goes up to Object (if
needed). createRandomFile will be found in Workstation and the code
will be executed. so far so good.
but HOW can the method be found there? I thought you need a method
dictionary for that... and Behavior supplies that method dictionary.
But Workstation has no "Behavior" in his direct class hierarchy,
"Workstation class" has (and Workstation is a instance of Workstation
class..)
I'd highly appreciate it if someone could help me with that matter!
Thanks,
Klaus