I’ve got a (poorly written) base class that I want to wrap in a proxy object. The base class resembles the following:
public class BaseClass : SomeOtherBase { public BaseClass() {} public BaseClass(int someValue) {} //...more code, not important here }
and, my proxy resembles:
public BaseClassProxy : BaseClass { public BaseClassProxy(bool fakeOut){} }
Without the ‘fakeOut’ constructor, the base constructor is expected to be called. However, with it, I expected it to not be called. Either way, I either need a way to not call any base class constructors, or some other way to effectively proxy this (evil) class.
If you do not explicitly call any constructor in the base class, the parameterless constructor will be called implicitly. There’s no way around it, you cannot instantiate a class without a constructor being called.