By that I mean, it is possible to mark a virtual method in C# as final so no other types deriving from this type, can override it ever again?
The solution with empty virtual methods gives no information on what is supported by a specific document instance. Furthermore, it forces you to add all possible methods in the base class. This forces all clients to be updated as whel, when you decide that the base class needs additional methods.
The derived classes inject their own implementation and definition of the virtual method. This means that in your application, you are able to call a method on a base class and cause its derived class's method to be executed.
By default, methods are non-virtual. You cannot override a non-virtual method. Virtual properties behave like virtual methods, except for the differences in declaration and invocation syntax. It is an error to use the virtual modifier on a static property.
Yes: when overriding a method you can also declare it sealed
.
You can use sealed.
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