comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: oo programing help needed?
Date: Sat, 06 Dec 2003 14:46:42 +0100
Date: 2003-12-06T14:46:42+01:00	[thread overview]
Message-ID: <1604044.udMrr1xGa3@linux1.krischik.com> (raw)
In-Reply-To: 4948f537.0312060221.6edfa391@posting.google.com

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 ;
> ---------------------------------------------
> with one;
> 
> package two is
>    type two is new one.one with private ;
>    private
>       type two is new one.one with null record;
> end two;
> ---------------------------------------------
> with two;
> 
> package three is
>    type three is new two.two with private ;
>    function  get_name(this:three)  return string;
>    private
>       type three is new two.two with null record;
> end two;
> 
> -------------------------------------------
> 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;
> 
> end three;
> 
> 
> i get no selector "name" for type three
> 
> how to solve this problem??????

three is not a child packages of one. While it it true that "private" is
more like "protected" in C++ and Java it is also part of the package. So
only child packages can acces the private section - child classes can't do
that. Java has something similar but I can't remember the actual syntax
(something like private proctected or protected private or so).

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://adacl.sourceforge.net




  parent reply	other threads:[~2003-12-06 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-06 10:21 oo programing help needed? shoko
2003-12-06 12:23 ` Georg Bauhaus
2003-12-06 14:11   ` Stephen Leake
2003-12-06 15:50     ` Steve
2003-12-06 13:46 ` Martin Krischik [this message]
2003-12-07  2:42 ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox