From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cd029b9d6c03962d X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Can't hide parts of ADTs in private children Date: 1998/11/16 Message-ID: #1/1 X-Deja-AN: 412297626 Sender: matt@mheaney.ni.net References: <364683EB.41C6@syd.csa.com.au> NNTP-Posting-Date: Sun, 15 Nov 1998 22:23:51 PDT Newsgroups: comp.lang.ada Date: 1998-11-16T00:00:00+00:00 List-Id: David Bowerman writes: > I am implementing an Abstract Data Type (Class) in a package. The code > goes something like this: [snip] > Can anyone suggest another way of doing it. Do this: package Class_X_Package is type Class_X is private; type Class_X_Ptr is access Class_X; ... operations on objects of type X private type Type_A is ...; type Type_B is ...; type Class_X is record Component_A : Type_A; Component_B : Type_B; ... end record; end Class_X_Package; If you prefer, you can declare nested packages private package A_Types is type Type_A is private; ... end A_Types; use A_Types; package B_Types is type Type_B is private; ... end B_Types; use B_Types; type Class_X is record Comp_A : Type_A; Comp_B : Type_B; ... end record; end Class_X_Package;