示例#1
0
        static void Main(string[] args)
        {
            Caller    c = new Caller();
            Rectangle r = new Rectangle(10, 7);
            Triangle  t = new Triangle(5, 10);

            c.CallArea(r);
            c.CallArea(t);
            Console.ReadKey();
        }
示例#2
0
        public void OOPs_Polymorhism_Dynamic()
        {
            Caller    c = new Caller();
            Rectangle r = new Rectangle(10, 7);
            Triangle  t = new Triangle(10, 5);

            c.CallArea(r);
            Assert.AreEqual(70, c.CallArea(r));

            c.CallArea(t);
            Assert.AreEqual(25, c.CallArea(t));
        }