What is the order of resolution for super() calls?

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 5 05:28:04 PDT 2015


Hi,

I just read 
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ which describes how super works in python (tl;dr: it's completely different from C++, java or D's super but super cool to deal with multiple inheritance).

For example, for the following inheritance tree:

           Object
             /    \
     Adam    Eve
         |   \    /   |
         |     X     |
          \   /   \  /
        Abel   Cain
              \   /
            David

A call in David making use of super would in python go through 
classes in that order:   Abel, Cain, Adam, Eve, Object.  This is 
somewhat peculiar as we don't expect the call of super() in Abel 
to go to Cain just because the initiator was David but that's 
what happens and it is deterministic (I recommend the article to 
see why it is so).

What would be the order in D? Would it be something like:
      Abel
      Adam
      Object
      Eve
      Cain
      (Adam?)
      (Eve?)
      (Object?)



More information about the Digitalmars-d-learn mailing list