Is it possible to do something like this?
class A { public virtual string prop { get { return "A"; } } } class B: A { private string X; public override string prop { get { return X; } set { X = value; } } }
That is, the base class provides a virtual property only with GET accessories, but the child class overrides GET and also provides SET.
The current example does not compile, but maybe I am missing something.
Added: To clarify, no, I do not want to redefine the new one. I want to add a new accessor. I know that this was not in the base class, so it cannot be overestimated. Ok, let me try to explain how it would look without syntactic sugar:
class A { public virtual string get_prop() { return "A"; } } class B: A { private string X; public override string get_prop() { return X; } public virtual string set_prop() { X = value; } }
Vilx- source share