From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d04a73d3b2c2dd0d X-Google-Attributes: gid103376,public From: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) Subject: Re: Q: Pointers to procedures/functions Date: 1997/04/12 Message-ID: <860814408.18snx@jvdsys.nextjk.stuyts.nl>#1/1 X-Deja-AN: 234263624 Distribution: world References: <1997Apr11.143821.5866@news> Organization: *JerryWare HQ*, Haarlem, Holland Newsgroups: comp.lang.ada Date: 1997-04-12T00:00:00+00:00 List-Id: >Is there a way to have pointers to procedures in Ada ? Yes, see RM 3.10. Example: with Ada.Text_IO; use Ada.Text_IO; procedure Test is type Function_Call is access function (N : Integer) return Integer; function Double_It (N : Integer) return Integer is begin return 2 * N; end Double_It; function Triple_It (N : Integer) return Integer is begin return 3 * N; end Triple_It; procedure Display (N : in Integer; F : in Function_Call) is begin Put ("Calling function on value" & Integer'Image (N)); Put (" results in" & Integer'Image (F (N))); New_Line; end Display; begin Display (4, Double_It'Access); Display (4, Triple_It'Access); end Test; -- -- Jerry van Dijk | Haarlem, Holland -- Business Consultant | Team Ada -- Ordina Finance | jdijk@acm.org