使用嵌套包类型作为类型的私有部分声明

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

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

回答

您可以做的是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;

  • Such conversions require no action at run-time and so should not affect performance.

以上是使用嵌套包类型作为类型的私有部分声明的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>