comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: What is the difference of "with null record" and "with private"?
Date: Sat, 24 May 2014 13:49:45 +0300
Date: 2014-05-24T13:49:45+03:00	[thread overview]
Message-ID: <llptg7$k5m$1@speranza.aioe.org> (raw)
In-Reply-To: mkPfv.206261$rF6.131387@fx04.iad

Shark8 wrote:

> On 23-May-14 12:19, Victor Porton wrote:
>> What is the difference of "with null record" and "with private"?
>>
>> Both denote a descendant of a type with no new additional public fields.
> 
> Incorrect.
> Null record does what you indicate, with private means that any fields
> aren't visible/public. Example:

I've said "no new additional PUBLIC fields" not just "no new additional 
fields"!

> Package Example is
>      Type Parent is tagged record
>          Data_1 : Integer;
>      end record;
> 
>      -- Returns Data_1
>      Function Get_Data (Item : Parent) return Integer;
> 
>      -- Contains Data_2, but this field is private.
>      Type Child is new Parent with private;
> 
>      -- Returns Data_2
>      Function Get_Data (Item : Child) return Integer;
> 
> 
> private
>      Type Child is new Parent with record
>          Data_2 : Integer;
>      end record;
> 
>      Function Get_Data (Item : Parent) return Integer is (Item.Data_1);
>      Function Get_Data (Item : Child)  return Integer is (Item.Data_2);
> 
> End Example;

-- 
Victor Porton - http://portonvictor.org


  reply	other threads:[~2014-05-24 10:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 18:19 What is the difference of "with null record" and "with private"? Victor Porton
2014-05-23 18:21 ` Victor Porton
2014-05-23 18:55   ` mockturtle
2014-05-23 19:42     ` Adam Beneschan
2014-05-23 22:05       ` Adam Beneschan
2014-05-24  8:19       ` mockturtle
2014-05-23 20:45     ` Georg Bauhaus
2014-05-23 18:59 ` Dan'l Miller
2014-05-23 21:45 ` Shark8
2014-05-24 10:49   ` Victor Porton [this message]
2014-05-24 17:33     ` Shark8
2014-05-23 21:55 ` Randy Brukardt
replies disabled

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