comp.lang.ada
 help / color / mirror / Atom feed
* HELP... Need QUICK answer on package
@ 1997-06-04  0:00 st-denis carole
       [not found] ` <01bc730c$d78439a0$84e2b8cd@p5120>
  0 siblings, 1 reply; 3+ messages in thread
From: st-denis carole @ 1997-06-04  0:00 UTC (permalink / raw)



Hello Guys,

I am a new ada programer and I am need to produce a package
very quickly. My problem is that I don't even know how to
do a Package. I am search in many books but I am still stuck at
the compiling process. You'll find my small program at the end of
this email. Could someone explain me why the compiler is complaining
about the first line and ask for the word "body". As I understood
a package must be build this way:

package MyPack is
   ...
end MyPack;
package body Mypack is
   ...
end MyPack;

And to use it:

with MyPack;
procedure CallMyPack is
begin
   MyPackFunction;
end;

So what's wrong with my program below.

Thanks you very much in advance!

My program:
--
package MyPackage is
	function MyPackageFunction(a:INTEGER;b:INTEGER) return INTEGER;
end MyPackage;
package body MyPack is
	function MyPackFunction(a:INTEGER;b:INTEGER) return Result is
		Result:INTEGER;
	begin
		Result := a+b;
		return Result;
	end MyPackFunction;
end MyPack;

with TEXT_IO;
procedure MyProcedure is
	package MY_INT_IO is new TEXT_IO.INTEGER_IO (INTEGER);
	use TEXT_IO,MY_INT_IO;
	use MyPack;
	somme:INTEGER;
begin
	PUT("La somme est egale a ");
	somme := MyPackFunction(1,2);
	PUT(somme);
	NEW_LINE;
end MyProcedure;




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

end of thread, other threads:[~1997-06-08  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-04  0:00 HELP... Need QUICK answer on package st-denis carole
     [not found] ` <01bc730c$d78439a0$84e2b8cd@p5120>
1997-06-07  0:00   ` Robert Dewar
     [not found]     ` <01bc73c7$26ddfda0$33fd1fcc@p5120>
1997-06-08  0:00       ` Robert Dewar

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