override(T)
Steven Schveighoffer
schveiguy at yahoo.com
Thu Sep 24 08:05:13 PDT 2009
On Thu, 24 Sep 2009 10:30:09 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Steven Schveighoffer wrote:
>> In the override(T) world, What does this do?
>> auto ls = new LotterySimulation();
>> ls.draw();
>> ???
>> I'm not sure this works...
>> -Steve
>
> That would be a compile-time error. You'd need to extract the interface
> you want to work with, and then call against it. In addition,
> LotterySimulation could offer convenience functions that do that.
OK. And it seems C# does the same thing, from what others are saying.
Unfortunately, we don't have a distinct scope-resolution operator (like
::) so there wouldn't be a way to do this without casting to the
interface, but I suppose in the cases where you are doing this, you aren't
generally using the object directly, only through an interface.
-Steve
More information about the Digitalmars-d
mailing list