* inheritence and generic
@ 2003-12-09 1:23 Ratson Janiv
2003-12-09 9:00 ` Dmitry A. Kazakov
0 siblings, 1 reply; 2+ messages in thread
From: Ratson Janiv @ 2003-12-09 1:23 UTC (permalink / raw)
I have the following code :
generic
type Bounded_Q is new Queue with private;
package Jr.Queue.Max_Queue.Bounded is
type Max_Bounded_Queue is new Max_Queue with private;
procedure Push(Q: in out Max_Bounded_Queue ; Item:T);
private
type Max_Bounded_Queue is new Max_Queue with record
BQ : Bounded_Q;
end record;
end Jr.Queue.Max_Queue.Bounded;
---------------------------------------------------------------------------
package body Jr.Queue.Max_Queue.Bounded is
procedure Push(Q: in out Max_Bounded_Queue;Item:T) is
begin
Q.BQ.Push(Q,Item);
end Push;
end Jr.Queue.Max_Queue.Bounded;
-------------------------------------------------------------
compile error :
jr-queue-max_queue-bounded.adb:5:11: no selector "Push" for type "Queue"
defined at jr-queue.ads:12.
what am I doing wrong ?
10x a lot,
Janiv.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: inheritence and generic
2003-12-09 1:23 inheritence and generic Ratson Janiv
@ 2003-12-09 9:00 ` Dmitry A. Kazakov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry A. Kazakov @ 2003-12-09 9:00 UTC (permalink / raw)
On Tue, 9 Dec 2003 03:23:25 +0200, "Ratson Janiv" <janiv@013.net.il>
wrote:
>I have the following code :
>
>generic
>
>type Bounded_Q is new Queue with private;
>
>
>package Jr.Queue.Max_Queue.Bounded is
>
>
>type Max_Bounded_Queue is new Max_Queue with private;
>
>
>procedure Push(Q: in out Max_Bounded_Queue ; Item:T);
>
>private
>
>type Max_Bounded_Queue is new Max_Queue with record
>
>BQ : Bounded_Q;
>
>end record;
>
>end Jr.Queue.Max_Queue.Bounded;
>
>---------------------------------------------------------------------------
>
>package body Jr.Queue.Max_Queue.Bounded is
>
>
>procedure Push(Q: in out Max_Bounded_Queue;Item:T) is
>
>begin
>
>Q.BQ.Push(Q,Item);
Shouldn't it be:
Q.BQ.Push (Q.BQ, Item);
But the design looks strange. You derive Max_Bounded_Queue from
Max_Queue and also aggregate Queue in it. In effect it will be twice a
queue. Should it be so?
--
Regards,
Dmitry Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-12-09 9:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-09 1:23 inheritence and generic Ratson Janiv
2003-12-09 9:00 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox