rtti cast

terranium spam at here.lot
Thu May 8 06:33:48 PDT 2008


BCS Wrote:

> The point is that offtent a failed cast is not an indecation of an 
> error. For instance code like this
> 
> class A {}
> class B1 : A {}
> class B2 : A {}
> 
> void foo(A a)
> {
>    if(auto b = cast(B1)a) {}
>    else if(auto b = cast(B2)a) {}
>    else {}
> }

I see polimorphism should help here.



More information about the Digitalmars-d mailing list