关于在 vista,Win7上属性重写的问题

我在父类写了一个属性

        private string m_Text = "abc";
        public virtual string Text
        {
            get { return m_Text; }
            set { m_Text = value; }
        }

在子类重写

        public override string Text
        {
            set
            {
                base.Text = value;
            }
        }

我在其他类中调用

            Child child = new Child();
            MessageBox.Show(child.Text)

这时候,我在除vista,Win7的系统上测试,都可以正常显示Text的值。但是在vista,Win7测试,具体跟踪的时候,查看Text的值,会出现cannot be used in this context because it lacks the get accessor。但是执行是没问题的。不知道是什么原因,Anyone can help me?


慕的地8271018
浏览 388回答 2
2回答

梵蒂冈之花

跟系统无关的 我不知道你在其他系统怎么会取到值,你是不是用了Parent child = new Child() ?
打开App,查看更多内容
随时随地看视频慕课网APP