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

It is possible to use NP.T as full declaration of P.T?

  • 2
    P.T and P.NP.T are different type declarations (eventually of different actual types). Then you need one more line to do what you want to do. – Zerte Jun 06 '21 at 12:32
  • I have several instances of the generic package in which types are created. I don't want to declare these packages in the visible part so as not to break the encapsulation, but instead provide functions to access them. – Андрей Гриценко Jun 06 '21 at 13:33

1 Answers1

7

What you can do is declare P.T in terms of NP.T as shown below.

p.ads

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;
DeeDee
  • 5,654
  • 7
  • 14