I am new to exception handling so i can't understand why in this code if i created an object with the empty parentheses, it doesn't throw the exception object but if i passed parameters to the constructor it works fine. If this has something to do with the type of constructor , can you mention the different types of constructor so i can google them . Thanks in advance.
class test {
public:
class error {};
test(){
throw error();
}
};
int main()
{
try {
test p();
}
catch(test::error)
{
cout <<"Error caught!"<< endl;
}
return 0;
}