我想通过一些练习,加强一下类与接口的知识,但是我不知道写什么 ,哪位能帮我出个注意,提供点素材,谢谢

解决方案 »

  1.   

    http://blog.csdn.net/xianfajushi/article/details/5933275不知道是不是
      

  2.   

    interface I
    {
        void foo();
    }
    class A : I
    {
        public void foo() { Console.WriteLine("A.foo"); }
    }
    class B : I
    {
        public void foo() { Console.WriteLine("B.foo"); }
    }
    class Program
    {
        void Main()
        {
            I a = new A();
            a.foo();
            I b = new B();
            b.foo();
        }
    }
      

  3.   

    唉,其实有了泛型和委托,接口这种Java中笨重的东西基本可以丢了。谁还愿意多实现一个类来调用一个接口呢。接口一般用来处理那些比较大的软件组件。