next up previous contents
Next: Sending messages Up: Message Passing Pattern Previous: Components of a constructor   Contents


Creating instances of a class

The diagram below illustrates what happens, when a constructor is invoked to create an instance of a class. The rectangles in the diagrams represent environment frames. Environment frames are linked with one another making up (together with the global environent) the total environment.

The label `$ <$environment 1$ >$' refers to the inherited environment and `$ <$environment 2$ >$' to the new environment frame created by the activation of a closure (call of a function). In our example `$ <$environment 2$ >$' has been created by calling the constructor `make-account'.

There are two closures of special interest in our example illustrated by the black bullets:

img66.gif\includegraphics{img/objdemo2a.eps}

next up previous contents
Next: Sending messages Up: Message Passing Pattern Previous: Components of a constructor   Contents

Georg P. Loczewski 2004-03-05


Impressum und Datenschutz