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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b61052ba3fdc8c26 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-31 15:13:05 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Integers and Mathematical Correctness Date: Wed, 31 Oct 2001 18:16:14 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:15518 Date: 2001-10-31T18:16:14-05:00 List-Id: "chris.danx" wrote in message news:Ij%D7.47224$a14.5418893@news6-win.server.ntlworld.com... > So when a new integer type is declared, a group of operators are created for > that type but their behaviour can be still be changed? Ok, I get it now! Yes. This is the same inheritance model like any other OO language. In general: package P is type T is ; procedure Op (O : T); ... end P; package Q is type NT is new T; end; At the point of declaration of Q.NT, operation Q.Op is implicitly declared. It doesn't matter that the parent type in your example was Standard.Integer -- the model is the same. Primitive operations of the parent type are inherited by the derived type. In the case of predefined types, you can "squirral away" (ha ha, Bob) a predefined operator prior to overriding it: package Q is type My_Integer is new Integer; function Predefined_Div (L, R: My_Integer) return My_Integer renames "/"; function "/" (L, R : My_Integer) return My_Integer; --override end; The saves you the trouble of having to convert back to the parent type in the body, when you need the predefined behavior (here, for division).