Re: exception catch
Rahul wrote:
> 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)
Don't catch exceptions by value, use a const reference.
--
Ian Collins.
|