我遇到了一个问题,派生类的基本构造函数没有被执行。我已经做了这个操作一百次了,但我无法理解为什么基本构造函数没有被执行。我希望有人能找到我遗漏的简单问题。以下是代码示例。有人知道为什么我的基本构造函数不是首先被调用吗?我有其他以同样方式实现的类,基本构造函数总是被首先调用。
if (item.GetType() == typeof(OtherChargeItem))
{
OtherChargeItemAddUpdateTest test = new OtherChargeItemAddUpdateTest((OtherChargeItem)item);
test.StartPosition = FormStartPosition.CenterParent;
test.ShowDialog();
}
public OtherChargeItemAddUpdateTest()
{
InitializeComponent();
}
public OtherChargeItemAddUpdateTest(OtherChargeItem item)
: base()
{
currentItem = item;
}