What is the significance of the keyword virtual in the method definition?
- The method with virtual keyword signifies that it can be overridden.
- Virtual keyword is a member function of a class.
- It is used in the base class method.Example:
public virtual A()
int c = a + b;
public override A()
int c = a * b;
- Virtual keyword is used to modify a method, property, indexer or event declaration.
- The implementation of a virtual member can be changed by an overriding member in a derived class.