Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Throwing a simple exception

Reply
Thread Tools

Throwing a simple exception

 
 
Computer Whizz
Guest
Posts: n/a
 
      10-28-2004

"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)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert.aspx throwing exception =?Utf-8?B?RXVzdGljZSBTY3J1YmI=?= ASP .Net 0 09-23-2005 03:51 AM
System.IO.Directoryinfo throwing exception =?Utf-8?B?R2xlbm4gVmVuemtl?= ASP .Net 3 07-25-2005 09:49 PM
WebRequest.GetResponse() throwing exception (Internal Server error =?Utf-8?B?VGVycnk=?= ASP .Net 4 01-13-2005 10:25 PM
Problem of throwing an exception (System.Net.Sockets.OverlappedAsyncResult::CompletionPortCallback) VincentWong ASP .Net 1 12-29-2003 09:32 AM
Throwing Exception in a composite control KJ ASP .Net 5 07-25-2003 01:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57