comp.lang.ada
 help / color / mirror / Atom feed
From: je@unix.brighton.ac.uk (John English)
Subject: Re: Initialization Params for Controlled Types
Date: Mon, 7 Nov 1994 09:08:03 GMT
Date: 1994-11-07T09:08:03+00:00	[thread overview]
Message-ID: <1994Nov7.090803.11439@unix.brighton.ac.uk> (raw)
In-Reply-To: 39ebsa$129i@watnews1.watson.ibm.com

Norman H. Cohen (ncohen@watson.ibm.com) wrote:
: In article <1994Nov4.134412.10010@unix.brighton.ac.uk>,
: je@unix.brighton.ac.uk (John English) writes: 

: |> C++ sidesteps this problem by making constructors non-inheritable.
: |> The only way to accomplish this in 9X is to make sure that Open isn't
: |> a primitive (e.g. by shoving it in a child package) which is fairly
: |> painful.

: Note that the danger of an inadvertent error could be avoided in Ada 9X
: by making the constructor a function returning a BankAccount value: 

:    function New_Bank_Account (Name: String) return BankAccount;

Yes, I should have declared it "type BankAccount is tagged limited private"
since I assume that copying a bank account shouldn't be allowed -- my mistake.
If this is so, you can't use a function for initialisation.

-- 
-------------------------------------------------------------------------------
John English                    | Thoughts for the day:
Dept. of Computing              | - People who live in windowed environments
University of Brighton          |   shouldn't cast pointers
E-mail: je@brighton.ac.uk       | - In C++ only your friends can access your
Fax:    0273 642405             |   private parts
-------------------------------------------------------------------------------



  parent reply	other threads:[~1994-11-07  9:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-27  9:44 Initialization Params for Controlled Types Angel Alvarez
1994-10-27 14:27 ` Tucker Taft
1994-11-04 13:44   ` John English
1994-11-04 22:16     ` Norman H. Cohen
1994-11-05 15:01       ` Cyrille Comar
1994-11-07 10:32         ` John English
1994-11-07  9:08       ` John English [this message]
1994-11-10 15:23       ` John English
1994-11-11 10:44         ` Robb Nebbe
1994-11-14 21:19         ` Norman H. Cohen
1994-11-14 18:35           ` Robert I. Eachus
1994-11-16 21:45           ` Matt Kennel
1994-10-27 23:06 ` Robert Dewar
replies disabled

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