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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,93d7def3eeefbc26,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: danmcleran@hotmail.com Newsgroups: comp.lang.ada Subject: Private area and child packages Date: 28 Dec 2004 20:05:58 -0800 Organization: http://groups.google.com Message-ID: <1104293158.276241.42640@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 172.138.3.199 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1104293162 8097 127.0.0.1 (29 Dec 2004 04:06:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 29 Dec 2004 04:06:02 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=172.138.3.199; posting-account=LSix6gsAAACmBFWMCbh6syCaua0lawvj Xref: g2news1.google.com comp.lang.ada:7277 Date: 2004-12-28T20:05:58-08:00 List-Id: Is there any way to hide implementation detail from child packages? An example, say I have a parent package like this: package Some_Package is type Secret_Type is private; private type Secret_Type is record Secret_Value : Integer := 0; end record; end Some_Package; I don't want any other component to be able to manipulate the Secret_Value record component, not even a child package of Some_Package. Is there any way to do this? In C++, there is something called the PIMPL idiom, where you hide implementation detail by holding a pointer to an incomplete class, like this: //SecretClass.h class Implementation;//Class not yet fully defined class SecretClass { public: //publicly visible stuff private: Implementation* pImplementation; }; So, no component outside of the implementation of SecretClass, (not even other classes that inherit SecretClass), has any knowledge of the structure of the implementation class. The full definition of the Implementation class is not provided in the header containing the definition of SecretClass. The Implementation class can either be defined in the cpp file that defines SecretClass, or seperately. I'm trying to figure out the most elegant way to do something like this is Ada and would like to read any ideas/suggestions.