( ) Refering parent classes ( )

Until now, we have only seen ways to refer classes down the hierarchy. This chapter explains how you can go up the hierarchy...

@parent

At any time, you can refer to the parent class (I.e. the one of which you are a child) using that @parent symbol. For instance, refering to @parent.titi will look for a child named @titi in your parent class.

@'something

Suppose you are in a class very deep in the hierarchy, and you need to access some very high level class.
For instance, you have a huge Amool class that describes your latest program, and deep in the gui-description, there is a little label that shows the version number of the program (in an 'about' window, for instance). This information is to be found in a direct child of the program named @versionNumber ...

If you know how many levels you must creep up, then you can do something like:
@parent.parent.parent.parent.parent.parent.parent.parent.parent.parent.versionNumber
But this is not very elegant, you might make a mistake counting the levels, and you won't know where you go when re-reading your code...

This is were the tick-notation comes in.

Your program has a super class named @program. So you can ask Amool to go up until it finds a subclass of @application. This is made putting a tick (') before the symbol application, like this:
@'application.versionNumber
This means that, first the compiler will go from parent to parent, until it finds one that is named application or has a superclass named application


Maxime Gamboni <> Last compiled : Wed Apr 23 21:53:40 CEST 2003