Exemplo n.º 1
0
        static void Main(string[] args)
        {
            SealedClass slc = new SealedClass();

            int total = slc.Add(6, 4);

            Console.WriteLine("Total = " + total.ToString());
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            /* ----------------Part-1-------------------
             */
            //usage of classes
            Box    Box1   = new Box(5.0, 6.0, 7.0);
            double volume = 0.0;


            volume = Box1.getVolume();//volume
            Console.WriteLine("Volume of Box1 : {0}", volume);

            Box1.count();
            Box1.count();
            Box1.count();

            Console.WriteLine("Variable num: {0}", Box.getNum());

            //static class usage
            Author.details();

            Console.WriteLine("Author name : {0} ", Author.A_name);
            Console.WriteLine("Book Name : {0} ", Author.B_name);
            Console.WriteLine("ID : {0} ", Author.id);

            //sealed class usage
            SealedClass slc   = new SealedClass();
            int         total = slc.Add(6, 4);

            Console.WriteLine("Total = " + total.ToString());

            //sealed method usage
            Printer p = new Printer();

            p.show();
            p.print();

            Printer ls = new LaserJet();

            ls.show();
            ls.print();

            Printer of = new Officejet();

            of.show();
            of.print();

            //abstract class usage
            Square s = new Square(6);

            Console.WriteLine("Area  = " + s.Area());

            Console.ReadKey();
        }