Overridable and Override in C# and VB
In C#, override is enabled by default so, is there no need to explicitly declare a method as overridable in the base class? If so
- Is Overridable just limited to VB.NET or it is required in C# as well?
- Hence which type of methods can be overridden? Is it only abstract methods of an abstract class or any method?
The Overridable keyword in VB corresponds to the virtual keyword in C#.
You have to make a method virtual to be able to override it. Abstract methods are automatically virtual.
In C#, any method marked as 'virtual' can be overridden. Methods marked as 'abstract' are not necessarily overridden, they are implemented in classes that implement the abstract class. They can be marked as virtual in the implementation. There is no limit to the number of times a virtual method can be overridden.
Do you need an answer for VB.NET?