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, T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c35d69ccf1ab6b78 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Another OOP Question Date: 1996/08/20 Message-ID: #1/1 X-Deja-AN: 175813163 references: <4vblni$j29@Masala.CC.UH.EDU> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-08-20T00:00:00+00:00 List-Id: I assume that the problem is that you want only part of the private properties of the parent to be visible to the child. There is a trick you can use in Ada 95 which may help with what you want. Actually, make that two tricks... package Foo is type Parent is tagged private; --visible methods on parent private package Hidden is type Real_Parent is tagged private; -- some partially hidden methods here. private type Real_Parent is tagged record.... --really well hidden methods here. end Hidden; type Parent is new Real_Parent with... -- hidden methods here too. end Foo; Now in children the public methods will be visible. In the private part, the hidden methods will be visible, but the state variables declared in the private part of Hidden.Real_Parent will not be visible. Also the operations in the private part of Hidden will be derived, but will not be visible in any children or directly in the body of Foo. Unless they override visible methods--for instance if Real_Parent is a derived type--the only way to access the really well hiden methods is through the visible operations in Hidden. Oh, I promised you a second way: package Foo is type Parent is tagged private; --visible methods on parent private type Parent is new with... package Hidden is -- some partially hidden methods here. private --really well hidden methods here. end Hidden; -- and some hidden methods here. end Foo; In this method the operations in Hidden are not derived for type Parent which may be and advantage. The visible operations in Hidden can be used on child types, but you need to do explicit conversions. This technique is very useful if you are defining operations which shouldn't be implicitly derived for child types. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...