(1) What is polymorphic, polymorphic is a class that shows a variety of different forms, and his core is that the subclass object is used as the parent object
(2) How to achieve polymorphism, in the CSharp, you can use the interface, virtual method, abstract class to achieve polymorphism, of course, regardless of the three kinds of the one to achieve polymorphism, need to rely on inheritance to achieve
(3) First look at what is an interface, interface can be regarded as a standard, all inherited subclasses need to follow the method declared in the interface to implement
(4) Then look at what is a virtual method, the virtual method is modified with virtual, overridden in the subclass with override, it is a method placed in the class, you can choose to rewrite in the subclass, or do not rewrite
(5) Finally look at what is abstract class, abstract class is a virtual class, can not create objects, with the abstract decoration, if the subclass is also an abstraction class, then all the abstract methods in the parent class, the property does not have to implement all; If the subclass is not an abstract class, all the abstract methods in the parent class must be fully implemented
Implementation of CSharp Polymorphism (virtual method)
Implementation of CSharp polymorphism (abstract class)
Implementation of CSharp polymorphism (interface)
An overview of the implementation of CSharp polymorphism