I am very new to Ada, and I am wondering why I have to write Acc.all, or d.all to call the procedures through the pointers. I thought .all was mainly for Records, because then you could set .all record values equal to some other record value. At the same time I am wondering why I am not required to do so when I am calling the function. Here is my code for reference. Please forget about AnimalPKG.Animals(Total, 3,2,1), as I am just practicing how to import packages.
with AnimalPKG, Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Main is
procedure thisisaccess is
begin
Put("thisisaccess");
end thisisaccess;
Type accessprocedure is access procedure;
procedure passinfunction(d : accessprocedure) is
begin
d.all;
end passinfunction;
function times5(a : Integer) return Integer is
begin
return a*5;
end times5;
Type times5access is access function(x : Integer) return Integer;
B : times5access := times5'Access;
Acc : accessprocedure;
Acc2 : accessprocedure; //Modification
Total : Integer;
begin
Acc := thisisaccess'Access; //Modification
Acc2 := Acc; //Modification
Acc2.all; //Modification
AnimalPKG.Animals(Total, 3,2,1);
Put(Total);
Acc.all;
passinfunction(Acc);
Put(B(3));
end Main;