I'm a bit confused about how to "throw" an illegal argument exception and do the whole try/catch thing.
In particular, I would like to do this to test the constructor and methods of a class I built.
So here is the situation - say I want the constructor to throw an illegal argument error if a parameter it receives is equal to or below 2, and execute smoothly otherwise.
//execute code normally
bool pass = false;
store = new Cat(2);
cout<<"Invalid Argument: "<< e.what() << endl;
How exactly do I "throw" an illegal argument from my constructor? My question extends to other exceptions as well, like runtime exceptions.