Beispiel #1
0
        static void Main(String[] args)
        {
            Rect     re = new Rect();
            Square   sq = new Square();   // heirarichal inheritance
            Cube     cu = new Cube();     // multi-level inheritance
            Multiple mu = new Multiple(); //Multiple inheritance

            re.setdim(50, 60);            //sets width 50 and height 60
            sq.setdim(30);                //sets length as 30
            cu.setdim(40);                //sets length as 40
            mu.Length();                  //length for M1 interface
            mu.Width();                   //width  for M2 interface
            Console.WriteLine("Area of rectangle is : " + re.getarea());
            Console.WriteLine("Area of Square using heirarichal inheritance is : " + sq.getarea());
            Console.WriteLine("Area of Cube using multi level inheritance is : " + cu.getcube());
            Console.WriteLine("Area using multiple inheritance is : " + mu.area());
        }