Exceptions: Difference between revisions

Content added Content deleted
(extended task to include trowing an exception)
No edit summary
Line 56: Line 56:
}
}
}
}

==[[C#]]==
'''Compiler''': MSVS 2005

public class MyException : Exception
{
// data with info about exception
};
void foo()
{
throw MyException();
}
void call_foo()
{
try {
foo();
}
catch (MyException e)
{
// handle exceptions of type MyException and derived
}
catch
{
// handle any type of exception not handled by above catches
}
}


==[[Python]]==
==[[Python]]==