comp.lang.ada
 help / color / mirror / Atom feed
From: "Sergey Koshcheyev" <serko84@hotmail.com>
Subject: Re: Ambiguous reference - What is wrong with this?
Date: Wed, 15 Aug 2001 09:38:06 +0200
Date: 2001-08-15T09:38:06+02:00	[thread overview]
Message-ID: <9ld8su$eak$1@ns.felk.cvut.cz> (raw)
In-Reply-To: 9lc0jf$hod$1@nh.pace.co.uk


"Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org> wrote in
message news:9lc0jf$hod$1@nh.pace.co.uk...
> Hmmmmmm........ I *think* I understand. This may take a bit of pondering.

Well, I should have explained that better, let me try it once more :-)
The problem is that you're overloading instead of overriding. And the
problem occurs because when Some_Proc is inherited for type Derive1, it
turns from
procedure Some_Proc
  (Object  : in out Base;
   Object2 : in out Base'Class);
to
procedure Some_Proc
  (Object  : in out Derive1;
   Object2 : in out Base'Class);
(note that the type of the Object2 parameter doesn't change)
so the Some_Proc you define doesn't override it.

> In any event, it isn't clear how I get out of it considering thatI'd kind
of
> like to keep the second parameter a 'Class wide type.

Ada is not covariant, so I'm quite sure an approach using tagged types for
both the containers and the  elements (in the context of your problem) won't
work.

> <snip>
> down can't hide some operation of one of its parents. I'd like to be able
to
> say my list can only accept elements of some subclass and increasingly
> restrict that subclass (see other posts in this thread.) By removing the

I think that having the root list package generic and adding new generic
parameters to child packages (and thus adding requirements for the stored
type) might work, but I haven't tested it and I don't know if it will be
appropriate for the problem you're solving. I can provide an example of what
I have in mind, if needed.

Sergey.





  reply	other threads:[~2001-08-15  7:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-14 15:14 Ambiguous reference - What is wrong with this? Marin David Condic
2001-08-14 16:56 ` Warren W. Gay VE3WWG
2001-08-14 17:45   ` Warren W. Gay VE3WWG
2001-08-14 17:54   ` Marin David Condic
2001-08-14 19:24     ` Warren W. Gay VE3WWG
2001-08-14 17:44 ` Sergey Koshcheyev
2001-08-14 20:10   ` Marin David Condic
2001-08-15  7:38     ` Sergey Koshcheyev [this message]
2001-08-15 13:49       ` Marin David Condic
2001-08-14 20:02 ` tmoran
2001-08-15  6:17   ` Simon Wright
2001-08-17 16:34     ` Marin David Condic
replies disabled

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