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,T_FILL_THIS_FORM_SHORT 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!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Mart van de Wege Newsgroups: comp.lang.ada Subject: Can't access record attribute in derived type Date: Wed, 08 Mar 2017 15:15:05 +0100 Message-ID: <86mvcv4zyu.fsf@gaheris.avalon.lan> Mime-Version: 1.0 Content-Type: text/plain X-Trace: individual.net cAaPidN5dczzihzKFCZvDgv9QH3ZC+MIXiAwHzW0VQfNrIjgQX X-Orig-Path: gaheris.avalon.lan!not-for-mail Cancel-Lock: sha1:2NqURh9tDQsNakSUQlZky0878rM= sha1:egVOHGa1QeKhizQHK9F1B4/qTCU= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) X-Received-Bytes: 1803 X-Received-Body-CRC: 1072489662 Xref: news.eternal-september.org comp.lang.ada:33490 Date: 2017-03-08T15:15:05+01:00 List-Id: Hi, I have the following definitions private type Creature is new Base_Creature with record Attributes : Attribute_Array; Gender : Possible_Gender := Unknown; Current_Hit_Points : Integer; Parents : Group_Of_Creatures.List; -- An instance of Ada.Containers.Indefinite_Doubly_Linked_Lists end record; In child package #1 (Persons): private type Person is new Creature with record [...] and in child package #2 (Knights): type Knight is new Person with record [...] I try to read the first element of the Parents attribute in knights.adb like this: function Father (K : in Knight) return Knight is begin return K.Parents.First_Element; end Father; And the compiler complains: "no selector "Parents" for type "Knight" defined" What am I missing here? The declarations are private, but shouldn't a tagged type inherit the entire record of its parent type? That means that it should have a Parents selector, shouldn't it? Mart -- "We will need a longer wall when the revolution comes." --- AJS, quoting an uncertain source.