comp.lang.ada
 help / color / mirror / Atom feed
From: je@bton.ac.uk (John English)
Subject: Re: problems using classwide types
Date: 1997/07/01
Date: 1997-07-01T00:00:00+00:00	[thread overview]
Message-ID: <5pb39k$9h4@saturn.brighton.ac.uk> (raw)
In-Reply-To: 33B10EF3.72B4@dcs.gla.NOSPAM.ac.uk


andy billimore (billimad@dcs.gla.NOSPAM.ac.uk) wrote:
:   type Transaction_Type is tagged private;
:   type Transaction_Ptr_Type is access all Transaction_Type'Class;
:   type Check_Type is new Transaction_Type with private;

: The main program looks like this -

: with Transactions; use Transactions;
: with Transactions.Checks; use Transactions.Checks;
: procedure Main is
:    L_Check : Check_Type;

L_Check : aliased Check_Type; -- so you can get an access value to it

:    TP : Transaction_Ptr_Type;
: begin
:    TP := new Check_Type;
:    TP := L_Check; -- Error (see below)

-- the value assigned to TP must be of type Transaction_Ptr_Type
-- L_Check is a Check_Type, not a Transaction_Ptr_Type, so do this:
TP := L_Check'Access;  -- i.e. a "pointer" to L_Check

: end Main;

---------------------------------------------------------------
 John English              | mailto:je@brighton.ac.uk
 Senior Lecturer           | http://www.comp.it.bton.ac.uk/je
 Dept. of Computing        | fax: (+44) 1273 642405
 University of Brighton    |
---------------------------------------------------------------




      parent reply	other threads:[~1997-07-01  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-25  0:00 problems using classwide types andy billimore
1997-06-25  0:00 ` Matthew Heaney
1997-07-01  0:00 ` John English [this message]
replies disabled

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