The virtual keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class.
When a virtual method is invoked, the run-time type of the object is checked for an overriding member. The overriding member in the most derived class is called, which might be the original member, if no derived class has overridden the member.
By default, methods are non-virtual. You cannot override a non-virtual method.
By using virtual, when the base class instance called the method, the most drived class’s method will be executed.