我有两个类....包裹和FundParcel ......,我想一个IEnumerable转换的子类型的超类型的一个IList的.... public class FundParcel : Parcel
{
/* properties defined here */
}
public class Parcel
{
/* properties defined here
一个很常见的模式我看到(我捡上Zend框架,只是因为我与它在这个问题的处理时刻),是这样的: class My_Form extends Zend_Form {
public function init() {
$this->addElement();
}
}
Zend_Form不是一个抽象类,但它本身是完全可用的。这似乎是“推荐”的地方,将你的表格“封装”
我尝试创建继承System.ICloneable接口的通用接口,但Clone()方法的返回类型是T.当然,T型需要约束要确定它是System.Object类的继承,但下面的代码不起作用。 public interface ICloneable<T> : System.ICloneable where T : object {
T Clone();
}
我在做什么错? 而且下面的
让说我有一个这样的类: public sealed class Foo
{
public void Bar
{
// Do Bar Stuff
}
}
而且我希望把它扩大到添加的东西超出了一个扩展方法可以做....我唯一的选择是组成: public class SuperFoo
{
private Foo _internalFoo;