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-30 09:29:58 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!EU.net!Germany.EU.net!news.dfn.de!scsing.switch.ch!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.? Date: 30 Sep 1994 10:20:56 GMT Organization: Ecole Polytechnique Federale de Lausanne Distribution: world Message-ID: <1994Sep30.111050@di.epfl.ch> References: <1994Sep27.165203.9192@swlvx2.msd.ray.com> <36bt0c$17oo@watnews1.watson.ibm.com> <1994Sep29.103358@di.epfl.ch> <36eebb$jn5@disunms.epfl.ch> 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:6333 comp.object:6921 comp.lang.c++:31095 Date: 1994-09-30T10:20:56+00:00 List-Id: stt@spock.camb.inmet.com (Tucker Taft) writes: : : The type conversion toward the end of your example is : illegal (at least according to *our* Ada 9X front end ;-). Damn. Thanks. Here's a fix, which is also accepted by GNAT :-) Is your Ada 9X front end a program, or a human? private package Company.Offices.Ptrs is function Ptr (The_Office : Office_Reference) return Office_Pointer; end Company.Offices.Ptrs; package body Company.Offices.Ptrs is function Ptr (The_Office : Office_Reference) return Office_Pointer is begin -- here we "see" that Office is derived from Office_Parent return Office_Pointer (The_Office); end Ptr; end Company.Offices.Ptrs; with Company.Employees.Ptrs; with Company.Offices.Ptrs; package body Company.Common is function Office_Occupied_By (The_Employee : in Employees.Employee) return Offices.Office_Pointer is begin return Offices.Ptrs.Ptr (Employees.Ptrs.Office_of (The_Employee)); end Office_Occupied_By; ... end Company.Common; : In any case, to me it is much simpler to declare abstract : versions of Employee and Office in the same package, with appropriately : mutually recursive (abstract) operations declared there as well. I agree, but John Volan wanted something else... My solution completely avoids showing abstract and/or class-wide stuff to the client. -- 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