我有一个(写得不好的)基类,我想要将其包装在代理对象中。该基类类似于以下内容:
public class BaseClass : SomeOtherBase
{
public BaseClass() {}
public BaseClass(int someValue) {}
//...more code, not important here
}
并且,我的代理类似于:
public BaseClassProxy : BaseClass
{
public BaseClassProxy(bool fakeOut){}
}
没有“fakeOut”构造函数,将会调用基础构造函数。然而,如果有了它,我希望不会调用基础构造函数。无论如何,我需要一种方法来不调用任何基类构造函数,或者其他有效地代理这个(邪恶的)类的方法。
public BaseClass() { if ( GetType() != typeof(BaseClass) ) return; ... }
- user12031933