Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > What's wrong wi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 5671 of 5828
Post > Topic >>

What's wrong with my code?

by amal.alphonse@[EMAIL PROTECTED] Apr 28, 2008 at 07:42 AM

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
 




 10 Posts in Topic:
What's wrong with my code?
amal.alphonse@[EMAIL PROT  2008-04-28 07:42:44 
Re: What's wrong with my code?
george.priv@[EMAIL PROTEC  2008-04-28 08:23:10 
Re: What's wrong with my code?
stefan-lucks@[EMAIL PROTE  2008-04-28 17:18:31 
Re: What's wrong with my code?
stefan-lucks@[EMAIL PROTE  2008-04-28 17:22:25 
Re: What's wrong with my code?
stefan-lucks@[EMAIL PROTE  2008-04-28 17:24:52 
Re: What's wrong with my code?
Ivan Levashew <octagra  2008-04-28 23:52:00 
Re: What's wrong with my code?
christoph.grein@[EMAIL PR  2008-04-28 22:30:29 
Re: What's wrong with my code?
Ludovic Brenta <ludovi  2008-04-29 02:18:01 
Re: What's wrong with my code?
Ludovic Brenta <ludovi  2008-04-29 02:31:23 
Re: What's wrong with my code?
amal.alphonse@[EMAIL PROT  2008-04-29 03:33:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:48:05 CDT 2008.