abstract:
Or a method of abstract class, an abstract class when follows:
public abstract class MigrateBase
{
protected abstract List<string> NeedReplaceColumn { get; }
}
MigrateBase other can be used as the base class, NeedReplaceColumn property must be overridden in a subclass thereof in, that in the override, and abstract method or property when fame, not writing implement;
virtual:
A virtual method, as follows
public abstract class MigrateBase
{
protected virtual List<string> NeedReplaceColumn
{
get
{
List<string> numlist = new List<string>(){
{"one"},
{"two"}
};
return numlist;
}
}
}
When virtual can override inherited by subclasses MigrateBase, may not override, override if not, the value is NeedReplaceColumn List <string> () {{ "one"}, { "two"}};
If the override, as follows:
public class MigratePatientsDocuments : MigrateBase
{
protected override List<string> NeedReplaceColumn
{
get
{
List<string> numlist = new List<string>(){
{"three"},
{"four"}
};
return numlist;
}
}
So when you run MigratePatientsDocuments class, NeedReplaceColumn value is:
List<string>(){
{"three"},
{"four"}
};
override:
Overloaded method, there are ways abstract parent class's subclasses must override this method, and virtual methods, you can not.
Reproduced in: https: //www.cnblogs.com/springyangwc/archive/2011/01/31/1948417.html