comp.lang.ada
 help / color / mirror / Atom feed
From: amal.alphonse@gmail.com
Subject: What's wrong with my code?
Date: Mon, 28 Apr 2008 07:42:44 -0700 (PDT)
Date: 2008-04-28T07:42:44-07:00	[thread overview]
Message-ID: <5a3b83ab-c9eb-448d-8e01-093df11bd3d2@b1g2000hsg.googlegroups.com> (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



             reply	other threads:[~2008-04-28 14:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-28 14:42 amal.alphonse [this message]
2008-04-28 15:18 ` What's wrong with my code? 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
replies disabled

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