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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, YOU_INHERIT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,900edaa189af2033 X-Google-Attributes: gid103376,public From: Gene Ouye Subject: Re: Ada95 OOP Questions Date: 1996/08/02 Message-ID: <3202C6A9.6BC8@rational.com>#1/1 X-Deja-AN: 171690204 references: <4tgi88$5fi@Masala.CC.UH.EDU> <4thu7u$ld3@mailsrv2.erno.de> <4tor2u$ksg@Masala.CC.UH.EDU> content-type: text/plain; charset=us-ascii organization: Rational Software Corporation mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (Win95; I) Date: 1996-08-02T00:00:00+00:00 List-Id: Spasmo wrote: > > Thomas Kendelbacher (Thomas.Kendelbacher@erno.de) wrote: > : In article <4tgi88$5fi@Masala.CC.UH.EDU>, cosc19z5@Bayou.UH.EDU (Spasmo) writes: [much deletia...] > : The latter is true: Even back in Ada 83, a derived type automatically > : inherited all operations declared with the original type (in line with > : the view of a type as "abstract data type"; the derived type would be > : meaningless without the operations!) This was of course preserved > : by Ada 95; the difference is that Ada 95 now has tagged types, while > : Ada 83 derived types were always incompatible with their parent types > : (save by explicit conversion), and data extension was not directly > : supported. > > Gotcha. So if I declare any type, tagged or not, then operations > will be inherited and I can refer to them in "child packages"? > This would mean that "inheritance" is pretty consistent regardless > of OO extensions or not eh? > Well, yes and no. If your notion of inheritance implies polymorphism, aka dynamic dispatching, then no. If you derive any type, you'll get the operations and the structure of the type, ie, the "record components" (or "data members" in other worlds ;-) but you won't get dynamic dispatching unless you're deriving from something that keeps some sort of type id that can be used at runtime, thus the "tag" of tagged records. So, if you want polymorphism with your inheritance, you have to derive from tagged types. There are other issues as well, but this is the biggest difference that most people notice when they come from other OOPLs.