R
Rahul
Hi Everyone,
I have the following exception class,
class E1
{
};
class E2
{
public: E2(const E1&)
{
printf("automatic type conversion\n");
}
};
int main()
{
try
{
throw E1();
}
catch(E2 obj)
{
printf("first handler\n");
}
catch(E1 obj1)
{
printf("second handler\n");
}
}
IN the above case, the E1 object is not converted into E2 and is
handled by the second handler, this suggests that automatic type
conversion doesn't happen with exceptions, i was wondering if this is
specified in standards and is there any reason for that?
Thanks in advance!!!
I have the following exception class,
class E1
{
};
class E2
{
public: E2(const E1&)
{
printf("automatic type conversion\n");
}
};
int main()
{
try
{
throw E1();
}
catch(E2 obj)
{
printf("first handler\n");
}
catch(E1 obj1)
{
printf("second handler\n");
}
}
IN the above case, the E1 object is not converted into E2 and is
handled by the second handler, this suggests that automatic type
conversion doesn't happen with exceptions, i was wondering if this is
specified in standards and is there any reason for that?
Thanks in advance!!!