我定义了一类,其中其成员变量用了TForm1 的对象 程序如下
头文件:
class TForm1 : public TForm
{
__published: // IDE-managed Components
TEdit *Edit1;
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
class a
{
public:
TForm1 a1;
};
程序:
a aa;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
aa.a1->Edit1->Text="阿嫂地方";
}
结果没法运行 显示以下错误:
[C++ Error] Unit1.h(24): E2459 VCL style classes must be constructed using operator new
[C++ Error] Unit1.cpp(18): E2125 Compiler could not generate default constructor for class 'a'
[C++ Error] Unit1.cpp(22): E2288 Pointer to structure required on left side of -> or ->*
请问应该怎么改.如何使自己定义的类引用Form的成员.
--------------------next---------------------
阅读(1645) | 评论(0) | 转发(0) |