override(T)

"Jérôme M. Berger" jeberger at free.fr
Sat Sep 26 07:17:25 PDT 2009


Daniel Keep wrote:
>
> Andrei Alexandrescu wrote:
>> ...
>>
>> So I was thinking of this:
>>
>> class LotterySimulation : Lottery, Figure {
>>     override(Lottery) void draw();
>>     override(Figure) void draw();
>> }
>>
>> This is easy to implement, scales well, and has good real world 
uses.
>> What say you?
>>
>>
>> Andrei
>
> Why not go with what C# uses?
>
> class LotterySimulation : Lottery, Figure {
>     override void Lottery.draw();
>     override void Figure.draw();
> }
>
> Just seems like a more obvious and natural place for it to me.  D
> already uses this to disambiguate symbols in other places.

	Except that the first option could be extended to allow overriding
several methods from the same interface at once:

class LotterySimulation : Lottery, Figure {
     override(Lottery) {
         void draw();
         void foo();
     }
     override(Figure) {
         void draw();
         void foo();
     }
}

		Jerome
-- 
mailto:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20090926/36a6ceea/attachment.pgp>


More information about the Digitalmars-d mailing list