예제 #1
0
        static void Main(string[] args)
        {
            //Using construtor 1
            Person kenn = new Person();

            kenn.FirstName = "Kenn";
            kenn.LastName  = "Pascascio";
            kenn.Age       = 40;
            kenn.TestMethod();

            //Using constructor 2
            Person kenn2 = new Person("Kenny", "Pascascio", 40);

            kenn2.TestMethod();

            Minor sophia = new Minor("Sophia", "O'Connor", 4, true);

            sophia.DemoMethod();
            sophia.TestMethod();

            Person jenn = new Minor("Jenn", "Aikins", 17, true);

            jenn.TestMethod();


            Console.ReadLine();



            //Person chris = new Person("Chris", "Sullivan");
            //chris.TestMethod();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Person chris = new Person("Chris", "Sullivan");

            chris.TestMethod();



            Minor sophie = new Minor("Sophie", "O'Connor", true);

            sophie.DemoMethod();
            sophie.TestMethod();

            Person kenn = new Minor("Kenn", "Pascascion", true);//Can do this. Inheriting fro

            kenn.TestMethod();

            Minor benn = new Person("Harry", "Smith");//Can't do that
        }