A derived class may override a virtual method of the base class with the keyword override. The following restrictions must be followed.
- Keyword override is used in the definition of child class method that is going to override the base class's virtual method.
- The return type must be the same as the virtual method have in base class.
- The name of the method should also be same.
- The parameter-list must also be same in order, number and type of parameters.
- The accessibility of the overriding method should not be more restricted than that of the accessibility defined with virtual method of the base class. This accessibility either be the same or less restricted.
- The virtual methods can be sealed in the child or derived classes to prevent further modifications in the implementation of the virtual method in the derived classes, by declaring them as sealed methods.