Short list with things to finish for D2
retard
re at tard.com.invalid
Thu Nov 19 00:37:22 PST 2009
Thu, 19 Nov 2009 09:33:07 +0100, Simen kjaeraas wrote:
> retard <re at tard.com.invalid> wrote:
>
>> Does the new system allow overriding only some binary operations and
>> not all of them at once?
>
> struct S {
> S opBinary( string op )( S rhs ) if ( op == "+" ) {
> // Do stuff
> }
> }
>
>> I thought generic member functions were non-virtual?
I meant this:
class foo {
int value;
this(int a) { value = a; }
foo opAdd(foo other) { return new foo(value + other.value); }
}
class bar : foo {
int value2;
this(int a, int b) { super(a); value2 = b; }
override foo opAdd(foo other) { return new bar(value + other.value,
value2+1); }
}
>
>
> Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>> 3. The template functions can't be virtual (fixable with a forwarding
>> thunk written once and for all).
More information about the Digitalmars-d
mailing list