comp.lang.ada
 help / color / mirror / Atom feed
* Overlaying of methods.
@ 1997-09-30  0:00 Stefan Muehlebach
  1997-09-30  0:00 ` Jon S Anthony
  1997-09-30  0:00 ` Tom Moran
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Muehlebach @ 1997-09-30  0:00 UTC (permalink / raw)



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.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1997-10-07  0:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-30  0:00 Overlaying of methods Stefan Muehlebach
1997-09-30  0:00 ` Jon S Anthony
1997-10-01  0:00   ` Stefan Muehlebach
1997-10-01  0:00     ` Jon S Anthony
1997-10-01  0:00       ` Tucker Taft
1997-10-01  0:00   ` Robert A Duff
1997-09-30  0:00 ` Tom Moran
1997-10-01  0:00   ` Stefan Muehlebach
1997-10-01  0:00     ` Robert A Duff
1997-10-07  0:00       ` Stefan M=?iso-8859-1?Q?=FChlebach
1997-10-07  0:00         ` Jon S Anthony
1997-10-01  0:00     ` Tom Moran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox