DELPHI声明问题

时间:2018-04-17 19:16:21

标签: delphi

我有这个模块:

    unit Unit1;

    interface
    uses classes;

    type TRObject = class(TObject) // reference count Object
    private
    FRecNo: longint;
    FRefCount: integer;
    FDeleted: boolean;
    public
    property RefCount: integer read FRefCount write FRefCount default 0;
    property RecNo: longint read FRecNo write FRecNo default -1;
    property IsDeleted: boolean read FDeleted write FDeleted default FALSE;
    procedure IncRF;
    procedure DecRF;
    constructor Create; overload;
    destructor Destroy; override;
    procedure SeekAndRead(var F: FILE; at: longint); // NEVER OVERLOADED
    procedure SeekAndWrite(var F:File;at: longint);
    procedure ReadObject(var F:FILE);  //NOT OVERLOADED AS ITS THE FIRST INSTANCE
    procedure WriteObject(var F:FILE); //NOT OVERLOADED AS ITS THE FIRST INSTANCE
    end;

    type TIDObject = class(TRObject) // Object with an ID number
    private
    FID: integer;
    public
    property ID: integer read FID write FID default -1;
    constructor create;  overload;
    destructor destroy;  override;
    procedure SeekAndRead(var F:File;at: longint);
    procedure SeekAndWrite(var F:File;at: longint);
    procedure ReadObject(var F: FILE); overload;
    procedure WriteObject(var F:FILE); overload;
    end;

    type TKeyObject = class(TRObject) // The key
    private:
    public:
    end;
    {
    private:
    FKey: string;
    public:
    property Key: string read FKey write FKey;
    constructor create; overload;
    destructor Destroy; override;
    procedure SeekAndRead(var F: File;at: longint);
    procedure ReadObject(var F: FILE); overload;
    procedure WriteObject(var F: FILE);overload;
    end;
    }
    implementation

    end.

我没有包含实施部分,因为老实说,它与问题无关。我在汇编期间得到的是这条消息:

[错误] unit1.pas [39]:'END'预期但':'找到了

我仔细观察,我只是看不出错误在哪里......我知道它的语法,但该死的,它是什么?当我在TKeyObject的声明中放置Private:(或Public :)这个词的时候,编译器会这样做。如果我有一个空的TKeyObject类,它不会给出错误消息(但是当我无法获得结构时,有什么用呢?帮助!

1 个答案:

答案 0 :(得分:1)

type
  TKeyObject = class(TRObject) // The key
  private:
  public:
  end;

删除错误的:符号。

编译器在其错误消息中的含义。它发现:无效。所以,搜索冒号。