Articles Archive
Director Forums
Director Wiki
Job Board
Search
 
 Director Online WikiMain Page | About | Help | FAQ | Special pages | Log in | Printable version | Disclaimers

Lingo Inheritance

From Director Online Wiki

Inheritance is a Object Oriented Programming feature. To use it in Lingo, do the following (note that this is different from the Director Documentation - but it is how inheritance actually works in Lingo. In a script that should inherit all properties and methods from an ancestor, create a property "ancestor".

like this:

 property ancestor

then in the script define the ancestor:

 ancestor = script("parent").rawNew()


rawNew creates the script without calling new. If you want to call new, do it this way:

 callAncestor(#new, me, anArgument)

Now you can access all properties and methods of the ancestors by using "me". Then Director will search through the Ancestor Chain and will find the latest definition of the property/method. Only if you use this way with rawNew, then using "me" in the ancestors will work properly (and use possible methods from the inheritant).

Retrieved from "http://www.director-online.com/dougwiki/index.php/Lingo_Inheritance"

This page has been accessed 1463 times. This page was last modified 17:41, 9 Apr 2005.