On Dec 23, 2006, at 7:52 PM, Karen wrote:
' try calling superclass method by casting - won't work
SubClass(self).raz "CallRaz pointer to SubClass(tester).raz"
True but you can access a shadowed property that way.
' explicitly call our superclass so it WILL work
super.raz "super.raz"
Yes this I use often ...
' Directly call a given method on an ancestor, not necessarily
immediate parent - this is NOT casting
ParentClass.raz "ParentClass.raz"
But this syntax I have never seen before and was not aware it could
be used outside calling class methods... I will have to try it as
I've done some contortions to do just that!
Worth pointing out here that we have a superior alternative in
REALbasic that isn't available in any other object oriented language:
implement your class hierarchy using events rather than method
overriding. Put your superclass in charge and have it delegate to its
subclasses, rather than putting the subclasses in charge. It's
clearer, and you're much less likely to need to rewrite all your
subclasses in order to modify the behavior that is shared in the
superclass.
Regards,
Guyren G Howe
guyren-at-relevantlogic.com
http://relevantlogic.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>