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,900edaa189af2033 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Ada95 OOP Questions Date: 1996/07/30 Message-ID: #1/1 X-Deja-AN: 171146775 references: <4tf3l4$4hu@masala.cc.uh.edu> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-07-30T00:00:00+00:00 List-Id: In article <4tkbm8$oto@Masala.CC.UH.EDU> cosc19z5@Bayou.UH.EDU (Spasmo) writes: > ...So what it is is that a subprogram really does belong to a class, > but the way we mark a subprogram as being a member of a class > is if it accepts that class as one of its parameters right? So > we're still passing objects to subprograms but inheritance, > etc... are in fact performed, it's just the arguments that > "tag" (loose use of this term) a subprogram as a class method > and imply inheritance into other packages. Not quite. A subprogram is inheritable if it is a primitive operation of the type. This basically means that it is declared in the same package specification (implicitly or explicitly) and has a parameter OR A RESULT of the type. A call to a primitive operation is dispatching if the type of the controlling operand must be determined at run-time. (If you declare two or more tagged types in a single package, you cannot declare subprograms which are dispatching operations of more than one of those types. RM 3.9.2(12) Just thought you might want to know. Of course, if you declare several tagged types in one scope, they are usually related by derivation, so in practice this is not too restrictive.) The real nice thing about Ada though, is that you don't need to understand what I just said. Write the code you want, and either the program will compile, link, and run, and do what you expected, or compiler will complain. (Most compiler error messages for these obscure rules do not indicate a violation of the rule, but some other bug. So if you run into one of these HUH? error messages, check the simple things first. A typical case is that you copied the declaration for a function on the parent, and changed the types of the parameters, but forgot to change the result type.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...