comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@ni.net (Matthew Heaney)
Subject: Re: How to overload assignment in Ada 95?
Date: 1996/12/09
Date: 1996-12-09T00:00:00+00:00	[thread overview]
Message-ID: <mheaney-ya023280000912962054110001@news.ni.net> (raw)
In-Reply-To: bbalfour-0912961334030001@stmac0088.std.caci.com


In article <bbalfour-0912961334030001@stmac0088.std.caci.com>,
bbalfour@std.caci.com (Brad Balfour) wrote:

>In article <58aclh$ssd@gaia.cc.gatech.edu>, chrisc@cc.gatech.edu
>(Christopher D Carothers) wrote:
>
>>        In 7.6 of the Ada95 LRM, it talks about
>>user-defined assignment. Could someone please 
>>provide me with an example of how I would in fact
>>"overload" the assignment operator for a particular
>>package. The LRM talks about the Ada.Finalization
>>package and the the "Adjust" procedure. However,
>>it does not give an example of how I would use
>>this package to achieve the "overloading" of assignment.
>
>I wrote up an example of this for an article in ACM SIGAda's Ada Letters
>magazine in Vol. XIV, No. 5, September/October, 1994.
>An online copy of this article can be found at:
>http://www.acm.org/~bbalfour/tips_no_1.html

Does anyone have a rule of thumb for when a controlled type should publicly
derive from type Ada.Finalization.Controlled?  For example

with Ada.Finalization;
...
package Unbounded_Stacks is

   type Unbounded_Stack is new Ada.Finalization.Controlled with private;
...

versus

with Ada.Finalization;
...
package Unbounded_Stacks is

   type Unbounded_Stack is private;
...
private

   type Unbounded_Stack is new Ada.Finalization.Controlled with
      record ... end record;
...

In the former case, clients of the Unbounded_Stack have direct visibility
to the operations Initialize, Finalize, and Adjust.  When is this a good
thing?  A bad thing?

--------------------------------------------------------------------
Matthew Heaney
Software Development Consultant
mheaney@ni.net
(818) 985-1271




  reply	other threads:[~1996-12-09  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-06  0:00 How to overload assignment in Ada 95? Christopher D Carothers
1996-12-07  0:00 ` Robert Dewar
1996-12-09  0:00 ` Brad Balfour
1996-12-09  0:00   ` Matthew Heaney [this message]
1996-12-10  0:00     ` Robert A Duff
1996-12-10  0:00     ` Brad Balfour
1996-12-10  0:00       ` Larry Kilgallen
1996-12-11  0:00         ` Brad Balfour
1996-12-11  0:00           ` Larry Kilgallen
     [not found]       ` <01bbe6dc$6feb3620$829d6482@joy.ericsson.se>
1996-12-11  0:00         ` Norman H. Cohen
1996-12-11  0:00         ` Brad Balfour
1996-12-10  0:00 ` Jon S Anthony
1996-12-11  0:00   ` Brad Balfour
1996-12-13  0:00     ` Robert A Duff
replies disabled

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