Exception子类继承的问题

orxor 2014-09-28 07:06:33
自定义了一个Exception的子类

TInetException = class(System.SysUtils.Exception)
private
protected
procedure RaisingException(P: PExceptionRecord); override;
public
end;

继承了RaisingException子类,可是编译的时候报错, E2037 Declaration of 'RaisingException\' differs from previous declaration,为什么?
...全文
461 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_18552917 2015-10-27
  • 打赏
  • 举报
回复
private protected procedure RaisingException(P: PExceptionRecord); override; public 可能是 private protected public 里的Exception
orxor 2014-09-30
  • 打赏
  • 举报
回复
unit System.SysUtils 里原形声明

  Exception = class(TObject)
  private
    FMessage: string;
    FHelpContext: Integer;
    FInnerException: Exception;
    FStackInfo: Pointer;
    FAcquireInnerException: Boolean;
    class constructor Create;
    class destructor Destroy;
  protected
    procedure SetInnerException;
    procedure SetStackInfo(AStackInfo: Pointer);
    function GetStackTrace: string;
    // This virtual function will be called right before this exception is about to be
    // raised. In the case of an external non-Delphi exception, this is called soon after
    // the object is created since the "raise" condition is already in progress.
    procedure RaisingException(P: PExceptionRecord); virtual;   //继承的这个
s11ss 2014-09-30
  • 打赏
  • 举报
回复
在TInetException声明之前是不是定义了另一个PExceptionRecord,导致跟原来的不一致
s11ss 2014-09-29
  • 打赏
  • 举报
回复
引用 2 楼 orxor 的回复:
声明在 protected,虚拟的
函数原型贴出来啊
orxor 2014-09-29
  • 打赏
  • 举报
回复
声明在 protected,虚拟的
s11ss 2014-09-28
  • 打赏
  • 举报
回复
看看Exception是怎么声明RaisingException的啊

16,749

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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