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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,66253344eaef63db X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,66253344eaef63db X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,66253344eaef63db X-Google-Attributes: gid1108a1,public X-Google-ArrivalTime: 1994-09-29 04:29:51 PST Path: bga.com!news.sprintlink.net!sundog.tiac.net!wizard.pn.com!Germany.EU.net!EU.net!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!swidir.switch.ch!epflnews!dinews.epfl.ch!di.epfl.ch!Magnus.Kempe From: Magnus.Kempe@di.epfl.ch (Magnus Kempe) Newsgroups: comp.lang.ada,comp.object,comp.lang.c++ Subject: Re: Mut. Recurs. in Ada9X w/o Breaking Encaps.? (LONG) Date: 29 Sep 1994 09:48:31 GMT Organization: Ecole Polytechnique Federale de Lausanne Distribution: world Message-ID: <1994Sep29.103358@di.epfl.ch> References: <1994Sep27.165203.9192@swlvx2.msd.ray.com> <36bt0c$17oo@watnews1.watson.ibm.com> NNTP-Posting-Host: lglsun4.epfl.ch Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Keywords: Ada 9X, C++, object-oriented Xref: bga.com comp.lang.ada:6293 comp.object:6887 comp.lang.c++:30943 Date: 1994-09-29T09:48:31+00:00 List-Id: Norm's solution could be further improved as follows: : One variation on this is to declare recursive types meant to serve as the : parents of types Employee and Office, but to provide no operations for : these recursive types. Then, in child packages, declare Employee and : Office themselves as derived types and declare primitive operations in : those child packages: Since this couple of recursive types is strictly internal to the abstraction "employee and his office", I recommend that they be declared as abstract and hidden in the private part of the parent package (Yes, this compiles with GNAT): package Company is private type Employee_Parent; type Employee_Pointer is access all Employee_Parent'Class; type Office_Parent; type Office_Pointer is access all Office_Parent'Class; type Employee_Parent is abstract tagged record Its_Occupied_Office : Office_Pointer; end record; type Office_Parent is abstract tagged record Its_Occupying_Employee : Employee_Pointer; end record; end Company; The rest of Norm's solution doesn't change; the couple of abstractions Employee and Office is declared in two child units of Company. To the client programmer, the encapsulation is strong but the relationship between the two abstractions is quite apparent because they are exported by the Company.* subsystem (a hierarchy of packages). -- Magnus Kempe "I know not what course others may take, but as for me, Magnus.Kempe@di.epfl.ch Give me Liberty... or give me Death!" -- Patrick Henry