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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC,T_FILL_THIS_FORM_SHORT,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d3068f3da76d28a0,start X-Google-Attributes: gid103376,public From: Denis Mouraux Subject: Forcing a tagged type to use a subsequent extention? Date: 1997/04/19 Message-ID: <33584CA6.52ADE15B@microtec.net>#1/1 X-Deja-AN: 236398557 X-Priority: 3 (Normal) Organization: Odyssee Internet Reply-To: mouraux@microtec.net Newsgroups: comp.lang.ada Date: 1997-04-19T00:00:00+00:00 List-Id: Hi! I think the best way to explain my problem is this piece of code: package A is type Object_Type is abstract tagged limited private; (...) private -- A type Element_Type is tagged record (...) end record; subtype Index is Integer range 1..Max; type Vector_Type is array (Index) of Element_Type; type Object_Type is abstract tagged limited record Vector : Vector_Type; N : Natural := 0; end record; end A; package A.B is -- <------- This is a child of A! type Object_Type is limited private; (...) private -- A.B type Element_Type is new A.Element_Type with record Extra : Some_Type; -- I add something here end record; type Object_Type is new A.Object_Type with record (...) -- I add something here too end record; end A.B; Now, what I'm trying to do is use the new Element_Type defined in A.B inside the array of the new Object_Type defined in A.B. So if Object is defined as being of type A.B.Object_Type, I could write something like Object.Vector(i).Extra... Of course, Object_Type is private, so that would be in the body of A.B. But in the way the code is now, I can't do that, because of course the Element is of type A.Element, which does not contain any field named Extra. I'm pretty sure I read something about that somewhere a few months ago, but I could'nt find it again (I tried the LRM, the FAQs, Lovelace...): I think there was some way to tell the parent type (Object_Type or Vector_Type probably) to use the latest definition of its component of Element_Type. Or maybe it was Element_Type itself that was told to "become" any new definition of itself in a child package... Any help will be appreciated. Thanks! (BTW, this is for an assignment at Universite du Quebec a Montreal...) o_ Denis Mouraux ____<\_____________________________________ email --> mouraux@microtec.net WWW --> http://www.microtec.net/~mouraux/