-1

I'm new to c++, using c++98

I'm trying to throw from the same function more than one exception and i'm struggling with the syntax - which made me wonder if that's even possible without a workaround...

The function should look like this:

Worker* CreateWorker(myIO* workerInfo) throw (AgeNotInRange), throw(WorkerTypeNotDefined);

I've tried also without the comma with no success...

Pete Becker
  • 74,985
  • 8
  • 76
  • 165
ba_0101
  • 13
  • 3

1 Answers1

1

It's:

Worker* CreateWorker(myIO* workerInfo) throw(AgeNotInRange, WorkerTypeNotDefined);

But, really, avoid exception specifiers.

Community
  • 1
  • 1
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055