comp.lang.ada
 help / color / mirror / Atom feed
* Constructors in Ada95
@ 2000-02-21  0:00 Andy Askey
  2000-02-22  0:00 ` Simon Wright
  2000-02-22  0:00 ` David
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Askey @ 2000-02-21  0:00 UTC (permalink / raw)


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

I want to call a procedure each time an object is instantiated for a
specific class/type and pass the current instance into the procedures.
(I could call the procedure after the object is instantiated, but it
will be easier on the user of my class/type if the procedure is
automatically called after instantiation.)  I looked into using a
Controlled type, but I still cannot figure out how to work on a
specific object instance's data.

For example (possible syntax errors included)...


package pkg is
  type type1 is tagged private;
private
  type type1 is tagged
    record
      i : integer := 0;
    end record;
end pkg;

package body pkg is
  ...
begin
  Proc_To_Call( This_Current_Instance : in Type1'class);
end pkg;


Any tips will be useful as I cannot find any info about this in any of
my Ada books.  I have "Ada(95) as a Second Language", so if you know
of a section that discusses C++ style constructors, please help me out
with the page numbers.  Also, any info on the web that deals with this
would be helpful.  I do not mind reading, but I don't have a lot of
time to figure out what it is I should read to answer my immediate
question.

Thanx.
--
----------------------------------------------------
|                   Andy Askey                     |
|                Software Engineer                 |
|           Raytheon Electronic Systems            |
|   353 James Record Road, Huntsville, AL 35824    |
|   Phone: (256) 772-4846  Fax: (256) 772-4771     |
|        andrew_j_askey@res.raytheon.com           |
----------------------------------------------------


--
Andy Askey
ajaskey@mindspring.com




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-02-22  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-21  0:00 Constructors in Ada95 Andy Askey
2000-02-22  0:00 ` Simon Wright
2000-02-22  0:00 ` David

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