comp.lang.ada
 help / color / mirror / Atom feed
* What's wrong with my code?
@ 2008-04-28 14:42 amal.alphonse
  2008-04-28 15:18 ` stefan-lucks
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: amal.alphonse @ 2008-04-28 14:42 UTC (permalink / raw)


Sorry if I'm posting in the wrong forum.

I have a generic package, with specification:

generic
   type Element is private;
   with procedure Element_Put(E : in Element);
package SelectionP is
   type My_Array is array (0..10) of Element;
   Max : constant Integer := 10;
   procedure Find_Min (A : My_Array; Offset : Integer; Pos : Integer);
   procedure Swap (A : in out My_Array; First : Integer; Second :
Integer);
   procedure Sort (A : in out My_Array);
   procedure Print (A : in My_Array);
end SelectionP;
--------------------------------------------------
and its package body is:

package body SelectionP is

   A : My_Array;

   procedure Find_Min (A : My_Array; Offset : Integer; Pos : Integer)
is
    ...
   end Find_Min;

   procedure Swap (A : in out My_Array; First : Integer; Second :
Integer)  is
      ...
   end Swap;

   procedure Sort (A : in out My_Array) is
     ...
   end Sort;
   procedure Print (A: in out My_Array) is
     ...
   end Print;

end SelectionP;
-------------------------------------------

And I try to make use of this package in this file:
with Ada.Text_IO, Ada.Integer_Text_IO;
with SelectionP;
procedure SelectionPUser is
   package IntSelectionP is new SelectionP(Integer, Ada.Text_IO.Put);
begin
   Ada.Text_IO.New_Line;
end SelectionPUser;

---

I try to compile but it says 'no visible subprogram matches the
specification for Element_Put' referring to the line above where I
make the new package IntSelectionP. I can't see what i've done wrong.

Also, is my code correct if my purpose is to use the package to create
arrays of different elements (integer, character, etc) and use the
procedures Find_Min and Sort and Print on them?

Thanks



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

end of thread, other threads:[~2008-04-29 10:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-28 14:42 What's wrong with my code? amal.alphonse
2008-04-28 15:18 ` stefan-lucks
2008-04-28 15:22   ` stefan-lucks
2008-04-28 15:24     ` stefan-lucks
2008-04-28 15:23 ` george.priv
2008-04-28 16:52 ` Ivan Levashew
2008-04-29  9:18   ` Ludovic Brenta
2008-04-29  5:30 ` christoph.grein
2008-04-29  9:31 ` Ludovic Brenta
2008-04-29 10:33 ` amal.alphonse

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