From: "M. A. Alves" <maa@borba.ncc.up.pt>
To: comp.lang.ada@ada.eu.org
Subject: Heterogenous_Array_Test: please explain error
Date: Tue, 12 Jun 2001 21:32:33 +0100 (WEST)
Date: 2001-06-12T21:32:33+01:00 [thread overview]
Message-ID: <mailman.992374395.5423.comp.lang.ada@ada.eu.org> (raw)
Isn't this the 'standard' way of implementing an heterogenous array?
Why is it not working? Please explain the compiler's error on the last
statement. Thanks.
procedure Heterogenous_Array_Test is
type Root is tagged record
Root_Component: Integer := 0;
end record;
type Child is new Root with record
Child_Component: Integer := 0;
end record;
type Class_Ptr is access Root'Class;
Item: array(1 .. 2) of Class_Ptr := (
1 => new Root,
2 => new Child);
begin
Item(1).Root_Component := 11;
Item(2).Root_Component := 21;
Item(2).Child_Component := 22;
-- error: no selector "Child_Component" for type "Root'Class"
end;
--
,
M A R I O data miner, LIACC, room 221 tel 351+226078830, ext 121
A M A D O Rua Campo Alegre, 823 fax 351+226003654
A L V E S P-4150 PORTO, Portugal mob 351+939354002
next reply other threads:[~2001-06-12 20:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-12 20:32 M. A. Alves [this message]
2001-06-12 19:44 ` Heterogenous_Array_Test: please explain error Ehud Lamm
2001-06-12 19:50 ` Ted Dennison
2001-06-13 9:52 ` Lutz Donnerhacke
2001-06-13 14:42 ` Ted Dennison
2001-06-13 14:48 ` Ehud Lamm
2001-06-13 15:40 ` Ted Dennison
2001-06-13 17:10 ` Ehud Lamm
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox