3
Answers

Dominique LeBlond: what happened in base class instructor

amit_gupta14

amit_gupta14

20y
2.1k
1
public class MyException : Exception { public MyException ( string message ) : base ( message ) { } } try { if(len>5) throw new MyException("length cannot be > 5"); } catch (MyException my) { Console.WriteLine(my.Message); } //----------------------------------- above, "length cannot be > 5" passed as parameter to base class constructor. What happened in base class instructor? How /why "length cannot be > 5" passed to catch block?
Answers (3)