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,aee6065fc75bfcb4,start X-Google-Attributes: gid103376,public From: Stefan Muehlebach Subject: Overlaying of methods. Date: 1997/09/30 Message-ID: <34310F93.41C6@htl-bw.ch>#1/1 X-Deja-AN: 276718966 X-Complaints-To: news@ubnnews.unisource.ch X-Trace: ubnnews.unisource.ch 875623498 24452 (None) 147.86.130.106 Organization: Technical University of Brugg-Windisch - Switzerland Newsgroups: comp.lang.ada Date: 1997-09-30T00:00:00+00:00 List-Id: Hello. I have a problem with objects and inherited methods. I have two classes, declared in two seperated packages, on inherited from the other. Both declare their own 'Init' procedures. Part of the first package: type XaCrowColumn is new XaContainer with private; type XaCrowColumn_Ptr is access all XaCrowColumn'class; procedure Init(o : access XaCrowColumn; parent : access XaApplication'class; orientation : ...; num_cols : Integer := 1; adjust_last : Boolean := True); (XaApplication is the parent class for all classes in my library) Part of the second package (which uses the one above): type XaCradioBox is new XaCrowColumn with private; type XaCradioBox_Ptr is access all XaCradioBox'class; procedure Init(o : access XaCradioBox; parent : access XaApplication'class; orientation : ...; num_cols : Integer := 1); In the main program I declare a new object the following way: myRadioBox: XaCradioBox_Ptr := new XaCradioBox; BUT - and that is the frustrating point - if I write a statement like this Init(myRadioBox, aParent, anOrientation); not the method in the second package is called but the one in the first! Although the first parameter is of type XaCradioBox. Why? I found out, that if I remove the defaults or write the same parameter list for both 'Init'-procedures every thing is ok. The question is also in which way does Ada look for an appropriate method. If someone could help me or at least verify my problem I would be very happy.