是的,您有一个简单的解决方法。您可以创建一个
TextBox以参数为参数的私有构造函数,并从您的公共构造函数中调用它。
public class Simple extends base { private Simple(TextBox t) { super(t); // continue doing stuff with t here } public Simple() { this(new TextBox()); }}对于更复杂的东西,您需要使用工厂或静态工厂方法。



