C # polymorphic implementation

definition

A class has many forms

achieve

Richter conversion


Virtual methods

step

1. The method of the parent marked as virtual methods, using the keyword virtual, this function can be overridden by subclasses


2. Calling


Abstract class

step

1. When a parent does not know how to achieve the abstract method method can be set to


2 calls

interface

step

Roughly the same abstract class

Guess you like

Origin www.cnblogs.com/wangchaoqi/p/12559939.html