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,d6fce62235e109c0 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Can you help with an Ada 95 OO Problem Date: 1997/01/18 Message-ID: #1/1 X-Deja-AN: 210764243 distribution: world references: content-type: text/plain; charset=ISO-8859-1 organization: Estormza Software mime-version: 1.0 newsgroups: comp.lang.ada Date: 1997-01-18T00:00:00+00:00 List-Id: In article , David Wallace wrote: > -- ***************** HELP *********** HELP *************************** > -- > Http.Headers.Init(Obj => Header_Ref); > > Text_Io.Put_Line("General Header Object has be initialised"); > > Obj.General_Header_Data := 4; My Ada95 is a little weak, so I might give you bad info. The subprogram reference "Http.Headers.Init" doesn't refer to the superclass implementation of that subprogram, it merely refers to the specification of the subprogram. The implementation of course can be overridden by any descendant. This appears to be what has happened here. You called a primitive operation with an argument of type General_Headers, not Headers, so the overridden subprogram is what gets called, and in this case infinate recursion was the result. This seems awkward at first; refering to the "specification" of the primitive operation by a different module reference than the module containing the implementation. In fact, Mitch Gart criticized this language "feature" a while back. The trick is always asking, What is the type of the object passed to the operation? It's the object that determines what operation gets dispatched at runtime, not the reference to the *specification* of the operation. Try a view conversion of the designated object, to get at its primitive operation: Http.Headers.Init (Obj => Http.Headers.Header (Header_Ref.all)); I'm not sure that will work, but try it and let me know (so I can learn, too!). There was some debate a while back about how to invoke the parent's implementation of the operation. There was one case (cited by Mitch) that required a very un-obvious technique. Perhaps your difficulties mean direct language support for "invoke parent's method" would be useful after all. matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271