Can I override a property in c#? How?
问题 I have this Base class: abstract class Base { public int x { get { throw new NotImplementedException(); } } } And the following descendant: class Derived : Base { public int x { get { //Actual Implementaion } } } When I compile I get this warning saying Derived class's definition of x is gonna hide Base's version of it. Is is possible to override properties in c# like methods? 回答1: You need to use virtual keyword abstract class Base { // use virtual keyword public virtual int x { get { throw