0
Base Class B
|
|
----
| |
| |
D1 D2
public static object GetDerivedClass(Type t1, MyProcess p1)
{
DerivedClass D1 = null;
DerivedClass D2 = null;
if (t1 is typeof(Derived)
{
Process(D1,p1);
return D1;
}
else if(t1 is typeof(Derived)
{
Process(D2,p1);
return D2;
}
}
我的问题是什么将返回其作为T1类型传递的对象类型的通用方法,继承如何返回子类对象?
,因为在实际执行我有很多D1,D2的我的设计模式的深层次,等等......
困惑......在图中是D1/D2 a * type *?或者(根据C#示例)a * variable *?那里有什么签名? – 2009-11-26 07:06:10
我认为该图表示一个类的层次结构... – 2009-11-26 07:12:35
我的观点是,它不符合所有**与代码示例... – 2009-11-26 07:35:30