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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fc203759328316c2 X-Google-Attributes: gid103376,public From: jsa@organon.com (Jon S Anthony) Subject: Re: Question about tagged types and functions Date: 1996/05/23 Message-ID: #1/1 X-Deja-AN: 156239494 sender: news@organon.com (news) references: <4ntg05$qgc@ns.interserf.net> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-05-23T00:00:00+00:00 List-Id: In article <4nvhdo$ri7@ns.interserf.net> dhunter@interserf.net (David Hunter) writes: > situation in which you end up with "derived_object := parent_object" > but doesn't Ada-95 forbid that anyway? I mean, you couldn't do > > d : DerivedType; > b : BaseType; > d := b; > > so the error "d := Create;" would be caught by the type > rules anyway, right? This is pretty much why the error is being flagged the way it is. If you assume that the current rule was not there and you did not have to override, then a new Create with result type DerivedType is implicitly declared _immediately_ after the declaration of DerivedType. So, the case you site: d := Create; would not have any type error at all. But, the actual Create bound here would be the Create with result type BaseType with an implicit conversion on the resulting object _away_ from the root of BaseType to DerivedType. Ba-Boom! See 3.4(17-23, 27) and 3.9.2(20). /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com