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

  1. Is Overridable just limited to VB.NET or it is required in C# as well?
  2. Hence which type of methods can be overridden? Is it only abstract methods of an abstract class or any method?

Answers


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?


Need Your Help

Decompile an APK, modify it and then recompile it

java android decompiling recompile

I need to modify an existing APK, modify the sources and then recompile it.

What do .c and .h file extensions mean to C?

c file-type cs50

It's all in the title; super-simple I reckon, but it's so hard to search for syntactical things anywhere.