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-Thread: 103376,38730e01f356adfa X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.190.247.MISMATCH!news-xxxfer.readnews.com!news-out.readnews.com!spool-big1.readnews.com!not-for-mail Newsgroups: comp.lang.ada Subject: Re: types and subtypes From: "Peter C. Chapin" References: <1142251677.837212.109000@i39g2000cwa.googlegroups.com> <1142273325.634632.41020@j52g2000cwj.googlegroups.com> Organization: Kelsey Mountain Software Message-ID: User-Agent: Xnews/5.04.25 Date: 17 Mar 2006 01:24:55 GMT NNTP-Posting-Host: 6180f6fa.news.sover.net X-Trace: DXC=anNdUbP@aZh:c^JI=HH@8bK6_LM2JZB_c=;Mo8F;50Sd:WUUlR<856oG2lSB8kAH8i:I;1Y^Z1`1d X-Complaints-To: abuse@sover.net Xref: g2news1.google.com comp.lang.ada:3390 Date: 2006-03-17T01:24:55+00:00 List-Id: ada_student@yahoo.com wrote in news:1142273325.634632.41020 @j52g2000cwj.googlegroups.com: > Why doesnt Ada subtyping also denote derivation as in the > sense C++ base classes and derived classes do? > > Why was Ada's subtyping defined to exclude derivation? Consider this... Suppose you had a C++ base class Vehicle from which you derived a class Car. class Vehicle { }; class Car : public Vehicle { }; In OO terms, Car is a "subtype" of Vehicle. But this is consistent with Ada's Positive being a subtype of Integer. The set of Car values is a subset of the set of Vehicle values just as the set of Positive values is a subset of the set of Integer values. To say a Vehicle is a Car is to restrict it... no longer are you talking about just any Vehicle. It is the same with Ada subtypes as far as I can see. Of course it is likely that class Car has more members than class Vehicle and thus has an extended implementation. However it defines a more restricted class of objects. Peter