From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: What is the difference of "with null record" and "with private"?
Date: Fri, 23 May 2014 15:45:51 -0600
Date: 2014-05-23T15:45:51-06:00 [thread overview]
Message-ID: <mkPfv.206261$rF6.131387@fx04.iad> (raw)
In-Reply-To: <llo3f0$mqp$1@speranza.aioe.org>
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:
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;
next prev parent reply other threads:[~2014-05-23 21:45 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 [this message]
2014-05-24 10:49 ` Victor Porton
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