首页 > 解决方案 > 使用嵌套包类型作为类型的私有部分声明

问题描述

package P is
   type T is private;
private
   package NP is
      type T is null record;
   end NP;
end P;

是否可以使用 NP.T 作为 PT 的完整声明?

标签: nestedpackagedeclarationada

解决方案


您可以做的是P.T按照NP.T如下所示的方式声明。

广告

package P is
   
   type T is private;
   
private
   
   package NP is
      type T is null record;
   end NP;
   
   type T is new NP.T;
   
end P;

推荐阅读