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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6b3cb4f0bf4a783e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-25 19:40:52 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3B37F6C4.C79E4CAE@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: C++ friend References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 26 Jun 2001 02:40:51 GMT NNTP-Posting-Host: 12.86.35.141 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 993523251 12.86.35.141 (Tue, 26 Jun 2001 02:40:51 GMT) NNTP-Posting-Date: Tue, 26 Jun 2001 02:40:51 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:9106 Date: 2001-06-26T02:40:51+00:00 List-Id: Ada does not have a direct equivalent to C++ friends. Ada has hierarchical compilation units. Ada compilation units may be a stand-alone subprogram or a package. The parent in a set of hierarchical units must be a package. Ada packages provide three levels of data hiding. Public members are defined in the package specification before the "private" keyword. Public members are just like public members in C++. Private members are defined in the package specification following the "private" keyword. Ada private members are most like C++ protected members. Members defined only in a package body are most like C++ private members. They are visible only within the package body. Hierarchical compilation units have special visibility into thier parent package. The public part of the child unit has visibility into the public part of the parent. The private part of the child unit has visibility into the public and private parts of the parent. The child unit has no visibility into the members defined in the parent package body. This provide similar capabilities to C++ friends. One difference is that the parent class in C++ must be modified for the addition of friends. A parent package in Ada requires no modification for the creation of child compilation units. This is a benefit because you can extend capability of stable, released code without changing the currently released compilation units, saving all the analysis, documentation, and testing costs associated with re-releasing working code. Remember that an Ada package is NOT a direct equivalent to a C++ class. An Ada package is a unit of encapsulation. Inheritance is achieved by extending tagged types, which are generally defined in packages. Data hiding is defined at the package level. Tagged types a usually either public or private, although a public tagged type may contain members of private types. Jim Rogers Colorado Springs, Colorado USA Richard Johnson wrote: > > Howdy, could someone point me to a good author or tell me if there is an > equivilent to a C++ friend in Ada95? > > If anyone knows of any examples or sources to examples it would be > appreciated :) > > I appologize if this subject has already been hashed to death, this is my > first time here :)