Cast Object - get null

Namespace rswhite4 at googlemail.com
Wed Apr 18 10:15:21 PDT 2012


> one another, you're going to need to overload opCast.
>
> - Jonathan M Davis

Thanks for your answer.
I have tried to overload opCast in this way:
U opCast(U)() const {
     return U(this.x, this.y);
}

But then i get this compiler error
cast.d(36): Error: no property 'opCall' for type 'object.Object'
cast.d(299): Error: template instance 
cast.Vector2D!(short).Vector2D.opCast!(Obj
ect) error instantiating
cast.d(36): Error: no property 'opCall' for type 'object.Object'
cast.d(299): Error: template instance 
cast.Vector2D!(float).Vector2D.opCast!(Obj
ect) error instantiating

The dokumentation of opCast is very short, did i understand 
opCast wrong?




More information about the Digitalmars-d-learn mailing list