From: olivea!news.bu.edu!inmet!spock!stt@uunet.uu.net (Tucker Taft)
Subject: Re: Question on Ada 9X vs Ada 83.
Date: 23 Sep 93 21:54:09 GMT [thread overview]
Message-ID: <CDtu69.JIH@inmet.camb.inmet.com> (raw)
In article <CDrDrJ.4px@News.MR.Net> info@xinotech.com (Brian Hanson) writes:
>I have a question about a compability issue and wonder if anyone on the
>net
>knows the answer or knows whom I could direct my question.
>
>The issue is "Derived type inherits all operations of Parent".
>
>An example is
>
> package P is
> type Some_Array is array (1 .. 10) of Integer;
> function "&" (Left, Right: Some_Array) return Some_Array;
> type New_Array is new Some_Array;
> end P;
>
>I understand that in Ada 9X, New_Array inherits "&" from Some_Array and
>that does not happen in Ada 83.
>
>The my questions are:
> 1 - Would this happen if these declarations were in a procedure body?
Yes. When a primitive operation is overridden, the overriding operation
becomes primitive as well, and is hence available for being inherited
on (subsequent) derivation (see RM9X-3.2.3(2);3.0/4.0 last sentence).
> 2 - If the function declaration was moved after the type declaration
>for
> New_Array would New_Array still inherit the "&" function from
> Some_Array?
No, a type only inherits primitive operations that are visible
at the point of the derivation (RM9X-3.4(16);3.0/4.0). So New_Array
would inherit the predefined "&" instead of the user-defined one
if the user-defined "&" were declared after the point of derivation.
>I have tried to figure this out by reading the Ada 9X RM but it was not
>very clear to me.
I hope the above citations help.
>Brian Hanson
S. Tucker Taft stt@inmet.com
Ada 9X Mapping/Revision Team
Intermetrics, Inc.
Cambridge, MA 02138
next reply other threads:[~1993-09-23 21:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-09-23 21:54 Tucker Taft [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-09-22 14:04 Question on Ada 9X vs Ada 83 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!spool.mu.ed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox