Inheritance in Revolution?

Ken Ray kray at sonsothunder.com
Fri Sep 10 09:56:37 EDT 2004


On 9/10/04 2:36 AM, "Arthur Urban" <aturban at qwest.net> wrote:

> Because that solution divorces the object from it's code and data. I do use
> "libraries", but only for stand-alone functions that are clearly not object
> behaviours.
> 
> I've discovered that I'm not really talking about inheritance here, but more
> class instantiation. Revolution only embraces the thought that every object
> is an instantiation of a single base class implementing a singleton pattern.
> I'd like to be able to declare a single object as a "class" from which I can
> instantiate multiple copies of it wherever I need them.

There is something similar that's been in discussion and will hopefully be
implemented in the next version (or the one after that), and it's being
called "parentScripts". Sort of an object-specific "backscript", you can
assign the script of an object as the "parentScript" to one or more other
objects. This would allow 25 buttons to use the same script of its parent.
Note that this is not the same as redefining the button class in code, but
it's close - you could drop a button in a hidden stack that acted like a
"class" - set its script, and then put a bunch of buttons on various stacks
that had this "class" button set as its parentScript.

Then, if the script of the parent changes, the behavior of all the
"instances" of those buttons changes as well.

For right now, however, the "clever workarounds" are the only thing we've
got.

:-)


Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list