ada package contains two parts: spec + body
spec contains public data, type, and function declarations.
body contains all function definitions.
main.adb:
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with cal;
use Ada.Integer_Text_IO;
use Ada.Text_IO;
use cal;
procedure Main is
A, B, C : Integer;
begin
A:= 10;
B:= 200;
C := add(A,B);
put_line("sum:");
put(C);
end Main;
cal.ads: package specification
package cal is
--type definitions
--variable declarations
--function declarations
function add (A: in Integer;
B: in Integer) return integer;
function sub (A : in Integer;
B : in Integer) return integer ;
end cal;
cal.adb: package body
package body cal is
function add (A : in Integer;
B : in Integer) return integer is separate;
function sub (A : in Integer;
B : in Integer) return integer is
begin
return (A - B);
end sub;
end cal;
cal-add.adb: package separate functions definitions
separate (cal)
function add (A : in Integer;
B : in Integer) return integer is
begin
return (A+B);
end add;