new
subtype_indication
new
defines the parent subtype. The parent type is the base type of the parent subtype. If a constraint exists for the parent subtype, a similar constraint exists for the derived subtype; the only difference is that for a range constraint, and likewise for a floating or fixed point constraint that includes a range constraint, the value of each bound is replaced by the corresponding value of the derived type. The characteristics of the derived type are defined as follows:
in
and in out
; a reverse conversion to the derived type happens after the call for the modes in out
and out
, see 6.4.1). In addition, if the result of a called function is of the parent type, this result is converted to the derived type.
type
LOCAL_COORDINATE is new
COORDINATE; -- two different types
type
MIDWEEK is new
DAY range
TUE .. THU; -- see 3.5.1
type
COUNTER is new
POSITIVE; -- same range as
POSITIVE
type
SPECIAL_KEY is new
KEY_MANAGER.KEY; -- see 7.4.2
-- the derived subprograms have the following specifications:
--
procedure
GET_KEY(K : out
SPECIAL_KEY);
-- function
"<"(X,Y : SPECIAL_KEY) return
BOOLEAN;