【问题标题】:Undeclared identifier for nested types from ancestor来自祖先的嵌套类型的未声明标识符
【发布时间】:2021-06-13 21:37:29
【问题描述】:

不明白为什么后代类TChild看不到祖先嵌套类型TLNested,编译器还是报错找不到。

E2003 未声明的标识符:'TLNested'

原始的简化层次结构如下所示。

  TAncestor = class abstract
  public
    type
      TLNested = class
      end;
  strict protected
    procedure DoSometing(AParam: TLNested); virtual; abstract;
  end;

  TChild = class(TAncestor)
  strict protected
    procedure DoSometing(AParam: TLNested); override;
  end;

不幸的是,即使我进一步简化它,它仍然不起作用。有谁知道我错过了什么?

  TAncestor = class
  public
    type
      TLNested = class
      end;
  end;

  TChild = class(TAncestor)
  public
    procedure DoSometing(AParam: TLNested);
  end;

【问题讨论】:

    标签: delphi delphi-10.3-rio


    【解决方案1】:

    您需要使用完全限定名称。

      TChild = class(TAncestor)
      public
        procedure DoSometing(AParam: TAncestor.TLNested);
      end;
    

    【讨论】:

      猜你喜欢
      • 2023-03-21
      • 2011-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多