So apparently you cannot use the virtual
modifier with the override
modifier.
virtual
- a method that can be overridden
You can declare a certain method as virtual
only once, but you can override
it as many times as you want - an override is not final, and it does not limit classes that inherit from the first overriding class. The method that will eventually execute is the last one the overrides the virtual method. So your code does behave as expected.
C# is very verbose with regard to overriding - you have more specifiers than C++ or Java. It is so to let the programmer specify the exact intent:
virtual
to specify a method can be overridden by subclasses. override
to specify you are overriding a method that you know is virtual (if it's not, the compiler will report an error). sealed
to prevent further overriding. new
to hide instead of override. This can be confusing and sometimes annoying, but it ensures you actually know what you're doing, and it makes your intention self-documented.