interface

class Program
    {
        public static void Main(string[] args)
        {
            test t = new test();
            test.Test(t);
            Console.WriteLine(t.Name);
            Console.ReadKey(true);
        }
    }
    interface Person{
        string Name{
            get;
        }
    
         void showName();
    }
    class test : Person{
        private string name = "小明";
        public string Name{
            get{
                return this.name;
            }
        }
        public static void Test(Person p){
            p.showName();
        }
        public void showName(){
            Console.WriteLine("output by method :  " + this.name);
        }
        
    }

 

posted @ 2017-12-04 11:07  我是外婆  阅读(224)  评论(0编辑  收藏  举报