C#扩充类

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 课本习题
{
    public class Animal
    {
        public Animal()
        {
            Console.WriteLine("基类构造函数:Hello,Animal");
        }
        public void Eat()
        {
            Console .WriteLine("扩充类方法:Eating");
        }
    }
    public class Cat:Animal
    {
        public Cat()
        {
            Console.WriteLine("扩充类构造函数:Hello,Cat");
        }
        public void Walk()
        {
            Console .WriteLine("扩充类方法:Walking");
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Cat cat=new Cat ();
            cat.Eat();
            cat.Walk();
            Console .ReadLine();
        }
    }
}


posted @ 2015-04-21 12:31  夜歌乘年少  阅读(207)  评论(0编辑  收藏  举报