【发布时间】:2015-08-15 22:11:30
【问题描述】:
我希望使用父实例实例化一个子类,以设置所有继承的变量。
例如:
public class Foo
{
//Variables
}
public class bar : Foo
{
public int ID { get; set; }
public bar(Foo instance)
{
base = instance; // Doesn't work but is generally the idea I'm looking for
}
}
【问题讨论】:
标签: c# inheritance