VB programmer's eye in the eyes of C # 6

zhaozj2021-02-08  257

The virtual function refers to a function of delay in the way to determine which method (one of a basic class or derived class) is delayed. Depending on the type, the function will be delayed to the runtime. For example, there is a class 'civilengineer', which contains a method called 'Charge'. This class is derived from Engineer, and Engineer has a method called 'Charge'. At this time, a virtual function will allow runtime judgment objects to be an engineer or a CIVilengineer, then perform the appropriate function.

Override modifier

Override has a relationship with inheritance. For example, both class 'a' and class 'b' have a function called 'SaveAllRecords', if the class 'b' inherits the class 'a', such 'b' is a derived class, and class 'a' Basic class. If you use Override this keyword to perform function 'SaveRecords', use functions in class 'b' in class 'a' in class 'a'.

Abstract class

The abstract class is basically the same as the normal class, but one or more member functions are marked as abstract types. Marking the member function as an abstract type means that this member function cannot be inherited.

Closure

To prevent classes from being inherited, this class can be labeled. At this time, any acts that try to derive from this class will result in compilation errors. Please see examples defined as closed classes:

转载请注明原文地址:https://www.9cbs.com/read-3273.html

New Post(0)