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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx04.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:32.0) Gecko/20100101 Thunderbird/32.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What is the difference of "with null record" and "with private"? References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Fri, 23 May 2014 21:45:54 UTC Organization: TeraNews.com Date: Fri, 23 May 2014 15:45:51 -0600 X-Received-Bytes: 1693 X-Received-Body-CRC: 2768695002 Xref: news.eternal-september.org comp.lang.ada:19994 Date: 2014-05-23T15:45:51-06:00 List-Id: 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;