コード例 #1
0
        /// <summary>
        /// Demonstrates inheritance
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // parent class message
            Kid kid = new Kid();

            kid.PrintMessage();

            // a child class message
            DisobedientKid disobedientKid = new DisobedientKid();

            disobedientKid.PrintMessage();

            // another child class message
            SharingKid sharingKid = new SharingKid();

            sharingKid.PrintMessage();

            Console.WriteLine();
        }