comp.lang.ada
 help / color / mirror / Atom feed
From: st-denis carole <st-denis.c@sympatico.ca>
Subject: HELP... Need QUICK answer on package
Date: 1997/06/04
Date: 1997-06-04T00:00:00+00:00	[thread overview]
Message-ID: <339638AC.1024@sympatico.ca> (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;




             reply	other threads:[~1997-06-04  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-04  0:00 st-denis carole [this message]
     [not found] ` <01bc730c$d78439a0$84e2b8cd@p5120>
1997-06-07  0:00   ` HELP... Need QUICK answer on package Robert Dewar
     [not found]     ` <01bc73c7$26ddfda0$33fd1fcc@p5120>
1997-06-08  0:00       ` Robert Dewar
replies disabled

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