Carlos Martinez Garcia wrote:
> Hi all:
>
> I have a class with a method that throws an exception.
>
> class A {
> public:
> void myMethod() throw(MyException);
> };
>
> My question is if MyExcepcion must be defined at that point or not.
> I think it must because if I use a forward declaration of MyExcepcion,
> compiler gives me an error.
>
> Is there any valid way without include the definition of MyException
> before A?
>
> Thanks in advance
The experts suggest not using exception specifications at all. See
these links:
http://www.gotw.ca/publications/mill22.htm
http://www.gotw.ca/gotw/082.htm
A quote from the first:
"So here's what seems to be the best advice we as a community have
learned as of today:
"Moral #1: Never write an exception specification.
"Moral #2: Except possibly an empty one, but if I were you I'd
avoid even that."
Not using such specs would likely eliminate your problem.
Cheers! --M