On 2010-02-21 08:56:14 -0500, Philippe Sigaud <[email protected]> said:
Anyway, I just tried:
class C {
alias opImplicitCast this;
@property int opImplicitCast() { return 1;}
}
auto c = new C();
int foo(int a) { return a;}
foo(c); // error. function main.foo (int a) is not callable using argument
types (C)
auto i = cast(int)c; // This works, but I'd call that explicit cast...
I'm doing something wrong there? Is calling foo on c an implicit cast?
I was using this to implicitly convert to an Object. Seems it does not
work for an int.
--
Michel Fortin
[email protected]
http://michelf.com/