Re: cast to a particular type
Daniel Bonniot <[email protected]> Wed, 05 May 2004 17:35:37 +0200
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Isaac Gouy wrote: >Is there a way to cast an Object to a particular type, without >introducing a temporary variable? > > No. In your example you could also declare x with the desired type instead of Object, and use cast. As proposed before, an additional feature could be implemented: allowing 'assert x instanceof A' statements to be taken into account by the typechecker. Tests like 'if (x instanceof A)' are already handled. In general, casts should be be exceptional, so making them shorter is rather a non-goal... Cheers, Daniel ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click