Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  
  In any method it can be useful to access something defined in
  the super class.  If you've not re-defined it in the sub-
  class, inheritance means that all you need to do is to use the
  instance variable/method name.  However, sometimes you've re-
  defined something but would still like to use the version in
  the super class.  To do this, for a property (instance
  variable) use the syntax:
  
            super:name
  
  and for a method:
  
            super:meth( <params> )
  
  The meaning of "super:" is the same as "self:" except that the
  OO system looks for the message (instance variable/method
  name) in the super class instead of the sub-class.
  
  The object that's used as "self" doesn't change, so the super
  class is going to be working with an object that's not of its
  own class.  Unless you re-define something in an incompatible
  way, things will be fine.  So, it's your responsibility not to
  introduce any bugs.
  
  Although self doesn't change, the OO system knows which class
  it found the message in, so if "super:" is used again the
  message look-up will start in the parent of the class found on
  the previous search.  The OO system saves and restores the
  "super:" positions as necessary.
  
  Here's another way to do the previous silly example:
  
       CLASS Cents INHERIT Dollars
            METHOD Init(nCents)      INLINE super:Init(nCents / 100)
       ENDCLASS
  
  Since super's Init() returns self, this INLINE also returns self.
  
  As mentioned, it's your responsibility to make sure "super:"
  will work.  Here's a bug:
       CLASS StringCents INHERIT Cents
            METHOD Init(cCents)      INLINE super:Init(cCents)
       ENDCLASS
  
  A fix would be to use super:Init(val(cCents)).
  
  
  You're not allowed to use "super:super:", although as stated
  above any method can use "super:", even if that method was
  invoked because of a previous "super:".
  
  You can probably make "super:self", "self:super", etc., work
  if you want.
  

  

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson