cb bug?

h2plus0 2003-08-24 11:07:47
cb 6.0, updaet 3, Win2k Prof.

创建一个简单的form, 就会stack overflow, 下面是代码.

class TForm2 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm2(TComponent* Owner, int id); // special contructor
};

// special contructor
__fastcall TForm2::TForm2(TComponent* Owner, int id)
: TForm(Owner)
{
}

Form1 创建一个 Form2.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TForm2* f = new TForm2(NULL, 1);
f->ShowModal();
delete f;
}

请问有谁知道这是什么原因?谢谢!
...全文
37 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
POLOM 2003-08-25
  • 打赏
  • 举报
回复
我想是不是因为cb中的那个构造函数不定义成虚函数,然后构造函数不能覆盖,所以。。。。
h2plus0 2003-08-24
  • 打赏
  • 举报
回复
是啊, 我试过 __fastcall TForm2::TForm2(int id, TComponent* Owner)就没问题,

但我想知道为什么会出这种问题, 不止borland以前发现没有?

ThinkX 2003-08-24
  • 打赏
  • 举报
回复
最好不要使用
__fastcall TForm2::TForm2(TComponent* Owner, int id)
这个构造,我记得它的基类有一个相同参数的构造函数,有可能冲突,
你再多传一个参数试试。

13,824

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧