I wrote a class in c# which inherits TextBox and now I want to add a virtual property to it:
public virtual Color WatermarkColor
{
private get { return _watermarkColor; }
set
{
_watermarkColor = value;
OnEnter(null);
OnLeave(null);
}
}
but this error occurred:
Error 1 'xXx.TextBoxPlus.WaterMark.get' is a new virtual member in sealed class 'xXx.TextBoxPlus'
You have declared TextBoxPlus
as a sealed
class, so it can't be subclassed. Therefore, the virtual
specifier is unnecessary because it will never be overridden.
Just remove the virtual
and you should be fine. (Or remove the sealed
from the class definition if you intend to subclass it later.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With