来自祖先的嵌套类型的未声明标识符

Undeclared identifier for nested types from ancestor

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

E2003 Undeclared identifier: '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;

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

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