为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

慕的地8271018 2018-11-05 05:07:51
我在父类写了一个属性        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?
查看完整描述

2 回答

?
梵蒂冈之花

TA贡献1900条经验 获得超5个赞

跟系统无关的 我不知道你在其他系统怎么会取到值,你是不是用了Parent child = new Child() ?

查看完整回答
反对 回复 2018-11-06
  • 2 回答
  • 0 关注
  • 387 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信