Virtual Keyword in C#
- When a derived class want to override the base class member(s) then base class member(s) need to marked as virtual members.
- A function marked as virtual can be overridden by subclasses wishing to provide a specialized implementation.
- Methods, properties, indexers, and events can all be declared as virtual.
- In the derived class those members will be marked by override keyword.