窗口继承的问题——Type name expected
我新建了一个窗口控件:
class TGraphForm : public TForm
{
__published:// IDE-managed Components
...
}
被另一个窗口继承:
#include "Graph.h"
//---------------------------------------
class TSpecForm : public TGraphForm Error:--Type name expected{
__published:// IDE-managed Components Error--__published or _automated sections only supported for VCL Class
{private:// User declarations
public:// User declarations
}
为什么会出现这样的情况啊,急求答案,谢谢
[解决办法]
// 把__published: 关键字拿掉,这个关键字一般用于你自定义组件时公布一些属性// 另外你的TSpecForm 的右花括号少了 ; 还少了构造函数和析构函数
[解决办法]
以下代码编译通过:
因为没有TMySeries 的声明,注释掉处理。
class TGraphForm : public TForm{__published: // IDE-managed Components TListView *PeakList; TPanel *Panel1; TImageList *ImageList; TTabControl *TabSet; TPanel *ParamsPanel; TLabel *MeasureTimeLabel; TLabel *WavelengthLabel; TLabel *WorkModeLabel; TLabel *MeanLabel; TLabel *GainLabel; TLabel *IntegralTimeLabel; TSplitter *PeakSplitter; private: // User declarationspublic: // User declarations virtual void __fastcall OnUpdatePlot(TObject *Sender); //virtual TMySeries * __fastcall AddSeries(TFgdFileHead FileInfo, AnsiString FileName);};class TSpecForm : public TGraphForm{__published: // IDE-managed Componentsprivate: // User declarationspublic: // User declarations __fastcall TSpecForm(TComponent* Owner); void __fastcall OnUpdatePlot(TObject *Sender); //TMySeries * __fastcall AddSeries(TFgdFileHead FileInfo,AnsiString FileName); bool __fastcall OnSave(TObject *Sender); bool __fastcall OnOpen(TObject *Sender); void __fastcall OnPrint(TObject *Sender); void __fastcall OnCalc(TObject *Sender);};
[解决办法]
不要相互包函头文件,你自己理一下看看.