I have a problem. I must throw an exception in the constructor One() but do not know how do I suppose to catch it. Can someone suggest something? I have tried this method: Throwing exceptions from constructors , What happens if a constructor throws an exception?
My code:
class One
{
    int a, b;
public:
    One()
    {
        a = 7;
        b = 0;
        if (b == 0)
        {
            throw "except";
        }       
    }
};
int main()
{
    One j;
    try 
    {
        cout << "good"; 
    }
    catch(const char *str)
    {
        cout << str;
    }
}
 
     
     
    