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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!zen.net.uk!dedekind.zen.co.uk!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: What is the difference of "with null record" and "with private"? Date: Sat, 24 May 2014 13:49:45 +0300 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: LRua1LhEwYx/r1KnMXeYtA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.12.4 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 1946 Xref: number.nntp.dca.giganews.com comp.lang.ada:186594 Date: 2014-05-24T13:49:45+03:00 List-Id: 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