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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,56db82f3595e6f1e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-06 06:12:49 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!fr.ip.ndsoftware.net!teaser.fr!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: oo programing help needed? Date: 06 Dec 2003 09:11:31 -0500 Organization: Cuivre, Argent, Or Message-ID: References: <4948f537.0312060221.6edfa391@posting.google.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1070719903 90515 80.67.180.195 (6 Dec 2003 14:11:43 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Sat, 6 Dec 2003 14:11:43 +0000 (UTC) Cc: comp.lang.ada@ada-france.org To: Georg Bauhaus Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.3 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:3177 Date: 2003-12-06T09:11:31-05:00 Georg Bauhaus writes: > shoko wrote: > : i have the following: > : ------------------------------------------ > : package one is > : type one is tagged private; > : type one_ptr is access all one'class; > : > : procedure set_name(name:String;this:in out one); > : function get_name(this:one) return string; > : > : private > : type one is tagged > : record > : name:String(1..256); > : end record; > : > : > : end one ; > ... > : ------------------------------------------- > : package body three is > : function get_name(this:three) return string > : s:string(1..10); > : begin > : return s+ this.name; <-- no selector "name" for type three > : end get_name; > > > In the definition of one in package one, you have chosen to > hide .name from view. But then you select a .name component > from within the body of package three, which as a package > is just any package, and thus cannot see the private > part of package one. (You could use get_name in three > because it is not in the private part of one. This might > be a good thing to do anyway as it respects the contract > for dealing with ones using one's public operations.) Or, you can make packages Two and Three child packages of One; then they have visibility to the private part of One. Which approach is correct depends on what your full application is. -- -- Stephe