comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@goanna.cs.rmit.edu.au>
Subject: Re: Converting C++ class to Ada
Date: 1996/12/12
Date: 1996-12-12T00:00:00+00:00	[thread overview]
Message-ID: <58npck$iku$1@goanna.cs.rmit.edu.au> (raw)
In-Reply-To: 32ADF183.7195@lmtas.lmco.com


"My main issues:
 
   (1) What do I do about the constructor? As I understand C++,
       I need to force the user to supply values for the components of
       Object_Type when something of that type is declared. How do I do
 this?"



The only way to force this seems to be the use of private types with
discriminants.


	type Object_Type(<>) is private;
	
which says this _may_ have discriminants, but that's private.

The only way to initialize and object, and you are forced to, is 
via a function.

E.g.

	Item : Object_Type; -- illegal, must be initialized
	
	Item : Object_Type := Init(....); -- Ok.
	
	
The full type definition does not have to have the discriminants.
IMHO, it would have been nicer to be able to say "this object must
be initialized when declared" by using a different mechanism to this 
(rather obscure) one.


Dale




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

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-10  0:00 Converting C++ class to Ada Ken Garlington
1996-12-11  0:00 ` Larry Kilgallen
1996-12-11  0:00 ` Stephen Leake
1996-12-13  0:00   ` Stephen Leake
1996-12-11  0:00 ` Jon S Anthony
1996-12-12  0:00   ` Ken Garlington
1996-12-18  0:00   ` Jon S Anthony
1996-12-18  0:00     ` Matthew Heaney
1996-12-19  0:00     ` Robert A Duff
1996-12-20  0:00       ` Stephen Leake
1996-12-20  0:00         ` Robert A Duff
1996-12-20  0:00   ` Jon S Anthony
1996-12-20  0:00     ` Mitch Gart
1996-12-20  0:00   ` Norman H. Cohen
1996-12-21  0:00   ` Jon S Anthony
1996-12-11  0:00 ` Norman H. Cohen
1996-12-12  0:00   ` Jon S Anthony
1996-12-12  0:00 ` Dale Stanbrough [this message]
1996-12-12  0:00   ` Constructors for Ada (was: Converting C++ class to Ada) Matthew Heaney
1996-12-13  0:00     ` Norman H. Cohen
1996-12-13  0:00       ` Matthew Heaney
1996-12-17  0:00   ` Robert I. Eachus
replies disabled

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