comp.lang.ada
 help / color / mirror / Atom feed
From: kronos.arc.nasa.gov!butch!LMSC5.IS.LMSC.LOCKHEED.COM!LJ10891@ames.arc.nas
Subject: Re: What's the difference between...
Date: 12 Feb 93 23:51:51 GMT	[thread overview]
Message-ID: <93043.57111.LJ10891@LMSC5.IS.LMSC.LOCKHEED.COM> (raw)

------------------------- Original Article -------------------------
>type Placement is range 0 .. 10;
>subtype Placement is INTEGER range 0 .. 10;

  I'm no maven, but I'll give it a shot.

  The first declaration defines a new type whose base type is the infamous
{anonymous integer}.  The second declaration defines a subtype whose base
type is the named type STANDARD.INTEGER.  This subtype inherits all of
the operations defined on its parent type.

   Illustrative example:

X : INTEGER := 5;
P1 : PLACEMENT_1 := 6;
P2 : PLACEMENT_2 := 6;

begin
  X := P1 + 3;  --illegal: result type is PLACEMENT_1
  P1 := X + 3;  --illegal: result type is INTEGER
  P2 := X + 3;  --legal
  P2 := X + 6;  --CONSTRAINT_ERROR
end;

   Hope that helps.  Send comments to ghaddad@lunacity.com.  Send flames
to someone@who.needs.them.

-------------------------------------------
I found these opinions on my doorstep, could you please give them a good home.

             reply	other threads:[~1993-02-12 23:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-02-12 23:51 kronos.arc.nasa.gov!butch!LMSC5.IS.LMSC.LOCKHEED.COM!LJ10891 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-02-16 17:34 What's the difference between John Bollenbacher
1993-02-16 16:17 enterpoop.mit.edu!ira.uka.de!scsing.switch.ch!sicsun!disuns2!lglsun!kipfe
1993-02-16 15:03 Robert I. Eachus
1993-02-15 13:24 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!haven.umd.ed
1993-02-15  1:55 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!portal!cup.portal
1993-02-14 19:55 Adam Beneschan
1993-02-14  3:08 agate!spool.mu.edu!sdd.hp.com!portal!cup.portal.com!R_Tim_Coslet
1993-02-13 19:18 agate!spool.mu.edu!hri.com!noc.near.net!inmet!spock!stt
1993-02-13  5:30 Alex Blakemore
1993-02-12 23:57 Mark A Biggar
1993-02-12 22:58 Robert I. Eachus
1993-02-12 18:52 Kenneth Anderson
replies disabled

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