comp.lang.ada
 help / color / mirror / Atom feed
* problems using classwide types
@ 1997-06-25  0:00 andy billimore
  1997-06-25  0:00 ` Matthew Heaney
  1997-07-01  0:00 ` John English
  0 siblings, 2 replies; 3+ messages in thread
From: andy billimore @ 1997-06-25  0:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-07-01  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox