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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,83f37cdf3c91adc6,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-02 10:25:55 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: Manu-CSS@gmx.de (Noivet) Newsgroups: comp.lang.ada Subject: variant record and pointer Date: 2 May 2003 10:25:53 -0700 Organization: http://groups.google.com/ Message-ID: <67ac8b2c.0305020925.6c27576d@posting.google.com> NNTP-Posting-Host: 62.227.49.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1051896355 19642 127.0.0.1 (2 May 2003 17:25:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 2 May 2003 17:25:55 GMT Xref: archiver1.google.com comp.lang.ada:36875 Date: 2003-05-02T17:25:55+00:00 List-Id: Hello! Maybe you can help me. I need a pointer with variant record. I have something like this: ------- type object is (circle, square, triangle); type node; type pointer is access node; type pointer (index: object) is record ptr: pointer; special: unbounded_string; case index is when circle => diameter: natural; when square => side: natural; when triangle => edge_1, edge_2, edge_3: natural; end case; end record; ------- now I can declare: s, t: pointer; and then use it: s := new node(circle); t := new node(square); s.diameter := 5; t.side := 3; s.side := 10; <------ and I wondered that the compiler compiled successfully! I expected a conflict, but there isn't. is there something wrong with my declaration of the pointer type? or can someone explain me that? Thx!