Idiomatic way to call base method in generic code

ZombineDev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 24 16:35:47 PDT 2015


On Sunday, 24 May 2015 at 23:32:52 UTC, ZombineDev wrote:
> ...

Small correction for clarity:
void main()
{
     Derived d = new Derived();
     d.x = 13;
     d.y = 15;

     // 1) writeln(callMethod!(Derived, Derived.toString)(d)); <- 
Should print 15
     // 2) writeln(callBaseMethod!(Derived, Derived.toString)(d)); 
<- Should print 13
     // 3) writeln(d.Base.toString()); <- Prints 13
}


More information about the Digitalmars-d-learn mailing list