1. The keyword virtual can declare a base class function as a virtual method. public virtualvoid myVirtualMethod(){}
2. You can also declare the attribute as virtual
public virtual int iCount { get; set; }
3. Virtual functions can be overridden in derived classes. Use the keyword override.
4. In Java, all functions are virtual, but C# is different. Except for constructors, functions in C# are not virtual by default, and C# requires that the override key must be used when rewriting functions in derived classes. word, display statement.
5. The benefit of override explicit declaration is that if the method name of the derived class is inadvertently slightly different from the base class, C++ will ignore the problem, but in C# a compilation error will occur because the function has been marked as override.
-