In order to improve the reusability and scalability of software modules, so as to improve the development efficiency of software, we always hope to make use of our predecessors ' or own previous development results, while we hope to have enough flexibility in our development process and not rigidly adhere to the reusable modules. Today, any object-oriented programming language must provide two important features: Inheritance (inheritance) and polymorphism (polymorphism).
If all classes are at the same level, this flat structure without relationships limits the object-oriented nature of the system. The introduction of inheritance is to establish an intersection between classes, so that instances of newly defined derived classes can inherit the characteristics and capabilities of existing base classes, and can add new attributes or modify existing ones to establish a hierarchy of classes.
The same operation acts on different objects, can have different interpretations, produce different execution results, this is polymorphism. Polymorphism is implemented by deriving classes that overload the virtual function method in a base class.
14.1 C # 's inheritance mechanism
14.2 polymorphism
14.3 Abstraction and sealing
14.3.1 abstract class for C #
Abstract methods for 14.3.2 C #
14.3.3 Sealing Class
14.3.4 Sealing method
14.4 Some questions about attributes in inheritance