Ejemplo n.º 1
0
        static void Main()
        {
            SBI  sbi  = new SBI();
            HDFC hdfc = new HDFC();

            //cant create object for abstract class (rbi)
            //RBI r = new RBI
            //so,accessing rbi informt through sbi and hdfc
            sbi.RBIEmployee();
            hdfc.RBIEmployee();
            Console.WriteLine("SBI --- education loan  = {0} || Homeloan = {1}", sbi.Educationloan(), sbi.Homeloan());
            Console.WriteLine("HDFC----education loan = {0} || Homeloan = {1}", hdfc.Educationloan(), hdfc.Homeloan());

            //Run Time Polymorphism ex: over riding
            RBI r;

            //object creation for SBI,refering to RBI r
            r = new SBI();
            Console.WriteLine("run time polymorphism");
            r.RBIEmployee();
            Console.WriteLine("SBI education loan  = {0}and SBI Homeloan = {1}", r.Educationloan(), r.Homeloan());
            r = new HDFC();
            Console.WriteLine("HDFC education loan  = {0} and HDFC Homeloan = {1}", r.Educationloan(), r.Homeloan());

            Console.Read();
        }
Ejemplo n.º 2
0
            static void Main()
            {
                SBI sbi = new SBI();

                sbi.Educationloan();
                sbi.Homeloan();
                Console.WriteLine("sbi house loan: {0}", sbi.Homeloan());
                Console.WriteLine("sbi education loan: {0}", sbi.Educationloan());

                HDFC hdfc = new HDFC();

                Console.WriteLine("hdfc houseloan {0}", hdfc.Homeloan());
                Console.WriteLine("hdfc educationloan {0}", hdfc.Educationloan());


                ///run time polymorphism
                RBI r;

                //object for SBI
                r = new SBI();
                r.RBIemployee();
                Console.WriteLine("sbi houseloan {0}", r.Homeloan());
                Console.WriteLine("sbi educationloan {0}", r.Educationloan());
                //object for HDFC
                Console.WriteLine("hdfc houseloan {0}", r.Homeloan());
                Console.WriteLine("hdfc educationloan {0}", r.Educationloan());

                Console.Read();
            }
Ejemplo n.º 3
0
        static void Main()
        {
            //cant create object for abstract class
            //RBI r = new RBI ();

            /*  SBI sbi = new SBI();
             * sbi.RBIEmployee();
             * Console.WriteLine("sbi h loan:{0}", sbi.Homeloan());
             * Console.WriteLine("sbi E loan:{0}", sbi.Educationloan());
             * HDFC hdfc = new HDFC();
             * Console.WriteLine("hdfc h loan:{0}", hdfc.Homeloan());
             * Console.WriteLine("hdfc E loan:{0}", hdfc.Educationloan());
             */
            //Run Time Polymorphism
            RBI r;

            // Object for SBI
            r = new SBI();
            r.RBIEmployee();
            Console.WriteLine("sbi h loan:{0}", r.Homeloan());
            Console.WriteLine("sbi E loan:{0}", r.Educationloan());
            r = new HDFC();
            Console.WriteLine("hdfc h loan:{0}", r.Homeloan());
            Console.WriteLine("hdfc E loan:{0}", r.Educationloan());
            Console.Read();
        }
        static void Main()
        {
            //can not create boject for abstract class
            //RBI r =new RBI();

            SBI sbi = new SBI();

            sbi.RBIEmployee();
            Console.WriteLine("SBI h loan:{0}", sbi.Homeloan());
            Console.WriteLine("SBI E loan:{0}", sbi.Educationloan());

            HDFC hdfc = new HDFC();

            Console.WriteLine("HDFC h loan:{0}", hdfc.Homeloan());
            Console.WriteLine("HDFC E loan:{0}", hdfc.Educationloan());

            //Run time polymorphism
            Console.WriteLine("----------------------------");
            Console.WriteLine("Run time polymorphism");

            //reference of RBI
            RBI r;

            //object for SBI
            r = new SBI();
            r.RBIEmployee();
            Console.WriteLine("SBI h loan:{0}", r.Homeloan());
            Console.WriteLine("SBI E loan:{0}", r.Educationloan());

            r = new HDFC();
            Console.WriteLine("HDFC h loan:{0}", r.Homeloan());
            Console.WriteLine("HDFC E loan:{0}", r.Educationloan());

            Console.Read();
        }