February 16, 2004 using cast() implicitly | ||||
---|---|---|---|---|
| ||||
imho this is unobvious error: int main(char[][] args) { T a = new T(); T b = new T(); T c = a+b; // good c = (a+b); // good c = (a)+(b); // ERROR: a is used as a type c = (a+b)+b; // good return 0; } class T { private int Value; this() { Value =1; } T opAdd(T inp) { T ret = new T(); ret.Value=inp.getValue()+Value; return ret; } int getValue() { return Value; } } |
Copyright © 1999-2021 by the D Language Foundation