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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e3ec0628d7b95a20,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-30 08:40:37 PST Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!opentransit.net!jussieu.fr!cnam.fr!not-for-mail From: Sami Evangelista Newsgroups: comp.lang.ada Subject: tagged types Date: Thu, 30 May 2002 17:30:19 +0200 Organization: Conservatoire National des Arts et Metiers Message-ID: <3CF6458B.8030307@wanadoo.fr> NNTP-Posting-Host: lmi14.cnam.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: kelvin.cnam.fr 1022772681 8007 163.173.228.14 (30 May 2002 15:31:21 GMT) X-Complaints-To: usenet@news.cnam.fr NNTP-Posting-Date: 30 May 2002 15:31:21 GMT User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126 Netscape6/6.2.1 X-Accept-Language: en-us Xref: archiver1.google.com comp.lang.ada:25007 Date: 2002-05-30T15:31:21+00:00 List-Id: i have declared an abstract type with two derived types like this type father is null record; type son1 is new father with record son1_field : integer; end record; type son2 is new father with record son2_field : boolean; end record; type access_son1 is access son1; type access_son2 is access son2; then i introduced a list of these elements and a procedure to add an element to the list like this: type access_father_class is access all father'class; type list; type access_list is access list; type list is record element : access_father_class; next : access_list; end record; procedure add(The_list : in out access_list; The_Element : access_father_class) is begin if The_list = null then The_list := new list; The_list.element := The_Element; The_list.next := null; else add(The_list.next, The_element); end if; end until there no problem. but how is it possible to add a son1 object to a list. I have tried this: my_object : access_son1 := new son1; my_object.son1.field := 0; my_list : access_list; ... add(my_list, my_object); and it gives me the following error message: expected type "access_father" found type "access_son" Thanks for any help Sami Evangelista