comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: Constructors in Ada95
Date: 2000/02/22
Date: 2000-02-22T00:00:00+00:00	[thread overview]
Message-ID: <x7v3dqlbv9t.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: h414bsc31c83a96l429kfeflk8rsfbk7fq@4ax.com

Andy Askey <ajaskey@mindspring.com> writes:

> I am sure this has been asked/answered several hundred times but
> nothing current appears in DejaNews.

Perhaps because there's a pretty full discussion in the LRM/Rationale!
If you don't have access, try www.adapower.com ..

with Ada.Finalization;
> package pkg is
>   type type1 is tagged private;
  type Type1 is new Ada.Finalization.Controlled with private;
> private
>   type type1 is tagged
>     record
>       i : integer := 0;
>     end record;
  type Type1 is new Ada.Finalization.Controlled with record
    I : Integer := 0;
  end record;
  procedure Initialize (T : in out Type1);
> end pkg;
> 
> package body pkg is
>   ...
  procedure Initialize (T : in out Type1) is
  begin
    ..
  end Initialize;
> begin
>   Proc_To_Call( This_Current_Instance : in Type1'class);
  -- no, leave this out.
> end pkg;

Initialize gets called whenever an object of type Type1 is created.

See also Adjust and Finalize.




      parent reply	other threads:[~2000-02-22  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-21  0:00 Constructors in Ada95 Andy Askey
2000-02-22  0:00 ` David
2000-02-22  0:00 ` Simon Wright [this message]
replies disabled

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