static void Main(string[] args)
        {
            var a = new Inheritor();

            CallMethodA(a);
            CallMethodI(a);
            CallMethodI1(a);
            CallMethodI2(a);

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            // Create an instance of Inheritor by using the constructor in the base class that takes three arguments.
            Inheritor inheritor = new Inheritor("Parameter Hineritor", "Parameter", new TimeSpan(3, 4, 0, 0));
            // Create an instance of ChangeRequest by using the constructor in
            // the derived class that takes four arguments.
            Inheritor2 inheritor2 = new Inheritor2("Parameter", "Parameter", new TimeSpan(4, 0, 0), 1);

            // Use the ToString method defined in Inheritor1.
            Console.WriteLine(inheritor.ToString());
            // Use the inherited Update method to change the title of the Inheritor2 object.
            inheritor2.Update("Parameter Hineritor 2", new TimeSpan(4, 0, 0));
            // Inheritor2 inherits Inheritor override of ToString.
            Console.WriteLine(inheritor2.ToString());
            // Keep the console open in debug mode.
            Console.WriteLine("Press key to exit.");
            Console.ReadKey();
        }
 private static void CallMethodI(Inheritor a)
 {
     a.Foo();
 }