Next: Essential features of object
Up: Message Passing Pattern
Previous: Sending messages
Contents
Executing methods
Indirectly invoking method deposit through the top-level variable `bal-set' caused the
following changes in the diagram to occur:
- the call of method `deposit' was initiated from the top-level via the
statement: (bal-set 100).
- a new environment frame was created for the lambda-abstraction `deposit' with the
argument of the call stored in it as a key/value pair: `amount 100'.
- the new environment frame was linked with the proper environment frame of the parent
of `deposit' which is the constructor of the object.
- the arrowed line labelled `env 1' shows that `deposit' has access to the environment
frame of its parent.
- the body of method `deposit' is displayed
- the return value of method `deposit'(200) is stored in the variable `balance' in the environment
frame of the parent (constructor). The diagram shows the value of `balance' before and after the
execution of `deposit' (100:200).
Georg P. Loczewski
2004-03-05