static void Main(string[] args) { var vp = new ValidPercent(50M); Percent p = vp; Console.WriteLine(vp); Console.WriteLine(p); try { var vp2 = new ValidPercent(101M); } catch (ArgumentException exc) { Console.WriteLine("Caught excepted exception: {0}", exc.Message); } }
static void Main(string[] args) { var vp = new ValidPercent (50M); Percent p = vp; Console.WriteLine (vp); Console.WriteLine (p); try { var vp2 = new ValidPercent (101M); } catch (ArgumentException exc) { Console.WriteLine ("Caught excepted exception: {0}", exc.Message); } }