dwt2 help

Saaa empty at needmail.com
Wed Mar 25 17:40:25 PDT 2009


> Obviously NumberFormatException can store another exception object
> inside.  This code effectively converts IllegalArgumentException into
> NumberFormatException, storing the original argument exception inside so
> that one can examine it later if they're curious.
Thanks, yes this is obvious...

>
>> [...]
>>
>>             catch(Object e){ // ConvError or ConvOverflowError
>> //Is this the correct translation?
>>                 throw new NumberFormatException( e );
>>             }
>
> It depends on what NumberFormatException can  accept as an argument.  If
> it accepts an Object then it's fine.

class NumberFormatException : IllegalArgumentException {
    this( String e ){
        super(e);
    }
    this( Exception e ){
        super(e.toString);
    }
}

Can Object be implicitly converted to Exception?





More information about the Digitalmars-d-learn mailing list