comp.lang.ada
 help / color / mirror / Atom feed
* coding problems, please help.
@ 2003-12-08 20:34 Ratson Janiv
  2003-12-08 21:31 ` Ratson Janiv
  0 siblings, 1 reply; 7+ messages in thread
From: Ratson Janiv @ 2003-12-08 20:34 UTC (permalink / raw)


with Jr.Queue;

with Jr.Queue.Max_Bounded_Queue;

use Jr.Queue.Max_Bounded_Queue;

procedure Q2 is

package My_Queue is new Max_Bounded_Queue(T=>Integer,">"=>">");


begin


null;

end Q2;

 compile error :

q2.adb:5:07: invalid prefix in selected component "Queue"

q2.adb:9:28: "Max_Bounded_Queue" is not visible

q2.adb:9:28: non-visible declaration at jr-queue-max_bounded_queue.ads:7

q2.adb:9:28: non-visible declaration at jr-queue-max_bounded_queue.ads:5

why ?

generic

   type T is private;

package Jr.Queue is
   type Queue is abstract tagged private;

   procedure Push(Q: in out Queue'class;Item:T) is abstract;
   procedure Pop(Q: in out Queue'class;Item:in out T) is abstract;
   function Empty(Q: Queue'class) return Boolean is abstract;

   private

      type Queue is tagged null record;

end Jr.Queue;



-------------------------

with Jr.Queue;

generic
package Jr.Queue.Max_Queue is

   type Max_Queue is abstract new Queue with null record;

   function Max(Q:Max_Queue) return T is abstract;

end Jr.queue.Max_Queue;


-----------------------

generic

   with function ">"(Item1,Item2:T) return Boolean;

package Jr.Queue.Max_Bounded_Queue is

   type Max_Bounded_Queue is new Queue with private;

   procedure Push(Q: in out Max_Bounded_Queue;Item:T);
   procedure Pop(Q: in out Max_Bounded_Queue;Item:in out T);
   function Empty(Q: Max_Bounded_Queue) return Boolean;
   function Max(Q:Max_Bounded_Queue) return T;

   Queue_Full, Queue_Empty :exception;

   private

   Num_Items : constant := 100;

   type Queue_Arr is array (1..Num_Items) of T;

   type Max_Bounded_Queue is new Queue with record
      Arr : Queue_Arr;
      I : Integer := 1;
      Max_Item : T;
   end record;

   procedure Find_Max(Q: in out Max_Bounded_Queue);

end Jr.Queue.Max_Bounded_Queue;



10x.





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

end of thread, other threads:[~2003-12-13 17:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-08 20:34 coding problems, please help Ratson Janiv
2003-12-08 21:31 ` Ratson Janiv
2003-12-09  7:48   ` Petter Fryklund
2003-12-09  8:40   ` Dmitry A. Kazakov
2003-12-13 15:13     ` Mr. J.
2003-12-13 17:19       ` Dmitry A. Kazakov
2003-12-13 14:58   ` Ratson Janiv

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