Le samedi 03 mars 2012 à 19:45 +0100, Adam D. Ruppe a écrit : > On Saturday, 3 March 2012 at 16:50:45 UTC, bioinfornatics wrote: > > can w do same in D ? > > alias this does that, although it does for all unknown > methods, not specific ones: > > struct A { > int[] data; > alias data this; > } > > A a; > > a[0] = 10; // this works like a.data[0] = 10; > > > alias this also lets you pass the struct > when the member is expected: > > void somethingWithArray(int[] arr) {} > > A a; > somethingWithArray(a); // works, passes a.data automatically
But when you have already a ctor ( class ) can you alias this ?