So apparently you cannot use the virtual
modifier with the override
modifier.
virtual
- a method that can be overridden
This behavior is right. If you don't want inherited class to override your virtual method, you can mark it "sealed" like this:
public class Line : DrawingObject
{
public sealed override void Draw()
{
Console.WriteLine("I'm a Line.");
}
}
After that LittleLine class won't be able to override Draw method.