Struct polymorphism?

Era Scarecrow rtcvb32 at yahoo.com
Mon Oct 8 08:05:56 PDT 2012


  Perhaps someone can help explain this mystery. I've got a 
working system, except when it's coming to an unknown function 
inside my structs.

  Perhaps to note opDispatch is added via a mixin template, not 
sure if that makes a difference.

Error: function expected before (), not 
'this.polyBase.opDispatch!("orig")'

   struct Base {
     PolyMorph polyBase;
     alias polyBase this;

     string callsOrig() {
       return orig(); //dies here
     }
   }

   //opDispatch signature
   auto ref opDispatch(string fun, Args ...)(auto ref Args args);


More information about the Digitalmars-d-learn mailing list