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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c83a22003c320b45 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-11-07 09:26:46 PST Newsgroups: comp.lang.ada Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!pipex!lyra.csx.cam.ac.uk!sunsite.doc.ic.ac.uk!dcs.gla.ac.uk!unix.brighton.ac.uk!je From: je@unix.brighton.ac.uk (John English) Subject: Re: Initialization Params for Controlled Types Message-ID: <1994Nov7.090803.11439@unix.brighton.ac.uk> Organization: University of Brighton, UK X-Newsreader: TIN [version 1.2 PL2] References: <1994Nov4.134412.10010@unix.brighton.ac.uk> <39ebsa$129i@watnews1.watson.ibm.com> Date: Mon, 7 Nov 1994 09:08:03 GMT Date: 1994-11-07T09:08:03+00:00 List-Id: 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 -------------------------------------------------------------------------------