Getting and using class hierarhy information in runtime

Uranuz neuranuz at gmail.com
Thu Feb 13 19:52:46 PST 2014


Yes. I was thinking about this but I want some more "clear 
looking" way of attaching handlers for errors, because I could 
have a lot of them and using a lot of if operators is not good 
for me.

> Exception e = ...;
>
> if(auto b = cast(BaseHTTPException) e) {
>    // use b of that type
> } else if(auto s = cast(SpecializedHTTPException) e) {
>    // use s, e is of this type
> }



More information about the Digitalmars-d-learn mailing list