"David Lindauer" <> wrote in message
news:...
>
>
> Richard Herring wrote:
>
>> In message <clo4ep$ss7$>, Computer Whizz
>> <> writes
>> >Along these lines - I just read in accel C++ that errors
>>
>> Exceptions.
Yes - sorry... I'm thinking back to VB and generally call any bug an "error"
on my part - since it IS.
>>
>> >have different
>> >types.
>>
>> An exception is simply something that is thrown and caught. You can
>> throw pretty much anything.
>> >
>> >Say you wanted an outer catch that would catch different types of errors
>> >for
>> >multiple reasons - I don't know exactly why - maybe just to save me
>> >typing
>> >loads of catches around area's that would give out errors... Is there
>> >such a
>> >way to do a catch?
>> >As it seems like you can only catch the errors with the appropriate
>> >type.
>> >
>> Read about polymorphism and the "is-a" relationship.
>>
>> If you derive your different error types from a single type Base, you
>> can catch them all with "catch (Base const & b)" because each derived
>> type is-a Base.
>
> along those lines you can catch anything in <stdexcept> with catch(
> exception
> const &b) because everything in that header is derived from exception...
>
> David
Ah. Thank you very much.
Will look into all this later on.
--
=========
Comp Whizz
=========
(The C++ beginner)
|