أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
when you create a method as virtual you can use it as it is in the sub classes(classes inherits from the original class containing the method)or Override it to define another behavior for this method for this class only (the child class)
A virtual method is a method that can be redefined in derived classes. A virtual method has an implementation in a base class as well as derived the class. It is used when a method's basic functionality is the same but sometimes more functionality is needed in the derived class. A virtual method is created in the base class that can be overridden in the derived class. We create a virtual method in the base class using the virtual keyword and that method is overridden in the derived class using the override keyword.