comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Variant records..
Date: Mon, 16 Feb 2004 23:17:10 GMT
Date: 2004-02-16T23:17:10+00:00	[thread overview]
Message-ID: <WbcYb.46205$uV3.91986@attbi_s51> (raw)
In-Reply-To: e8f9995c.0402151451.5bbe03de@posting.google.com

How about instead:
   type Vehicle_Type is abstract tagged null record;

   procedure Set_Speed(This : in out Vehicle_Type; S : in Speeds);
   function State_Of(This : Vehicle_Type) return States;

   type Vehicle_Power is (MANUAL, AUTOMATIC);

   type Car is new Vehicle_Type(Power : Vehicle_Power) with null record;
   procedure Shift_Gears(This : in out Car;
                         New_Gear : Positive);

   type Man is new Vehicle_Type with null record;
   ...

   Audi : CAR(Power => MANUAL);
   John : Man;
   ...
   Set_Speed(Audi, 65);
   Set_Speed(John, 6);
   Shift_Gears(Audi, New_Gear=>2);
   Shift_Gears(John, New_Gear=>2);  -- illegal



  parent reply	other threads:[~2004-02-16 23:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-15 22:51 Variant records Ganesh Ramasivan
2004-02-16 10:57 ` Preben Randhol
2004-02-16 15:25   ` Ganesh Ramasivan
2004-02-16 15:46     ` Ludovic Brenta
2004-02-16 16:16     ` Preben Randhol
2004-02-17 14:37       ` Ganesh Ramasivan
2004-02-17 15:43         ` Preben Randhol
2004-02-16 16:59   ` Ganesh Ramasivan
2004-02-16 20:14     ` Simon Wright
2004-02-17 14:56       ` Ganesh Ramasivan
2004-02-17 15:31         ` Robert I. Eachus
2004-02-16 23:17 ` tmoran [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-09-14  0:00 Variant Records Shawn Barber
1999-09-14  0:00 ` Matthew Heaney
1999-09-14  0:00 ` David C. Hoos, Sr.
1999-09-14  0:00 ` Mark Lundquist
1986-10-31  9:08 variant records Dean Luick
1986-11-03 14:17 ` Bev Sobelman
1986-11-05 16:35 ` stuart
1986-11-06 15:40 ` stt
replies disabled

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