comp.lang.ada
 help / color / mirror / Atom feed
From: andy billimore <billimad@dcs.gla.NOSPAM.ac.uk>
Subject: problems using classwide types
Date: 1997/06/25
Date: 1997-06-25T00:00:00+00:00	[thread overview]
Message-ID: <33B10EF3.72B4@dcs.gla.NOSPAM.ac.uk> (raw)


I'm looking for some help with classwide types.

I have defined a parent type -
  type Transaction_Type is tagged private;

And a classwide access type to objects of Transaction_Type'Class -
  type Transaction_Ptr_Type is access all Transaction_Type'Class;

I have then defined a child class, Transactions.Checks -
  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;
   TP : Transaction_Ptr_Type;
begin
   TP := new Check_Type;
   TP := L_Check; -- Error (see below)
end Main;

Compiling this produces the following output - 

main.adb:24:10: expected type "Transaction_Ptr_Type" 
	        defined at transactions.ads:5

main.adb:24:10: found private type "Check_Type" 
		defined at transactions-checks.ads:2

gnatmake: "main.adb" compilation error

So I can allocate enough memory to hold an object of Check_Type, but I
can't assign anything to it which I don't understand.


Andrew




             reply	other threads:[~1997-06-25  0:00 UTC|newest]

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

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