日期:2014-05-17  浏览次数:20742 次

【C#新手求教帖】看书遇到一个关于继承的问题
 代码如下:
  public class Enumerator :  IEnumerator, IDisposable //这是什么?为什会有两个接口?允许多个接口
        {                                              //被一个类继承么?
            private int state;
            private object current;

            public Enumerator(int state)
            {
                this.state = state;
            }

            public bool MoveNext()
            {
                switch (state)
                {
                    case 0:
                        current = "Hello";
                        state = 1;
                        return true;
                    case 1:
                        current = "World";
                        state = 2;
                        return true;
                    case 2:
                        break;