Posted by Natalie on July 15, 2001 at 21:46:12:
In Reply to: Re: baz posted by jason pepas on July 15, 2001 at 20:07:28:
I have a try and catch block around where I try to create the foo, but I am still having some trouble.
Inside some of his methods in the foo class, he has stuff like:
throw throw_me_when_out_of_room;
baz throw_me_when_out_of_room = new baz_out_of_memory();
Where are the baz_out_of_memory, etc. classes defined. Are we supposed to define them ourselves?
Thanks,
Natalie
: i figured it out. its just basic exception handling.
: you need to use try and catch when creating a foo, but the catch statement has to accept a baz argument.
: see
: http://www.cplusplus.com/doc/tutorial/tut5-3.html for a good overview.
:
: : i'm in the same boat.
: : i just tried using the baz and foo examples which weiren provided, and when creating a foo with the foo constructor, it checks to see if you can create it with magic_bad_arg_check, and if it fails that check, baz throws a flag.
: : the problem is, i have no idea how to check what flag baz throws.
: : on top of that, the program just stops running when such a flag is thrown and echos "Aborted" to the console, at least when i try it.
: : surely we aren't the only two having this problem...
:
: : : Yo...
: : : What's up on baz.h ????
: : : This makes no sense....not to mention the fact that the file has changed a couple of times already in the last 24 hours.
: : : It seems like we are supposed to catch his baz in our foo handler to see if one of 4 different errors occurs. Further, it seems like his existence counter of 100 is likely to change, and thus he wants us to catch his generic baz, instead of hard-coding in a test for 100 foo instances. However, there is no explanation anywhere of how to test which baz is thrown, or even what some of them do....I don't have a clue what to do with the first and last one...
: : : Can anyone enlighten me? Does anyone have something in their foohandler that will correctly catch the different baz's ? Are we supposed to modify baz.h ourselves?
: : : Thanks in advance.