File: RM-3-4.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (277 lines) | stat: -rw-r--r-- 21,547 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>Ada95 - Derived Types and Classes</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-3-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-4-1.html">Next</A></P>
<HR>
<H1> 3.4 Derived Types and Classes</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1442"></A>A <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>
defines a new type (and its first subtype) whose characteristics are
<I>derived</I> from those of a <I>parent type</I>. <A NAME="I1443"></A></DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">derived_type_definition<A NAME="I1444"></A>
::= </FONT>[<B>abstract</B>]&nbsp;<B>new</B>&nbsp;<I>parent_</I><A NAME="I1445"></A><FONT FACE="Arial, Helvetica">subtype_indication</FONT>&nbsp;[<A NAME="I1446"></A><FONT FACE="Arial, Helvetica">record_extension_part</FONT>]</DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1447"></A><A NAME="I1448"></A>The <I>parent_</I><FONT FACE="Arial, Helvetica">subtype_indication</FONT>
defines the <I>parent subtype</I>; its type is the parent type.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;A type shall be completely defined (see <A HREF="RM-3-11-1.html">3.11.1</A>)
prior to being specified as the parent type in a <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>
-- the <FONT FACE="Arial, Helvetica">full_type_declaration</FONT>s for
the parent type and any of its subcomponents have to precede the <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1449"></A>If there is a <FONT FACE="Arial, Helvetica">record_extension_part</FONT>,
the derived type is called a <I>record extension</I> of the parent type.
A <FONT FACE="Arial, Helvetica">record_extension_part</FONT> shall be
provided if and only if the parent type is a tagged type. </DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;<A NAME="I1450"></A><A NAME="I1451"></A>The first
subtype of the derived type is unconstrained if a <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT>
is provided in the declaration of the derived type, or if the parent
subtype is unconstrained. <A NAME="I1452"></A>Otherwise, the constraint
of the first subtype <I>corresponds</I> to that of the parent subtype
in the following sense: it is the same as that of the parent subtype
except that for a range constraint (implicit or explicit), the value
of each bound of its range is replaced by the corresponding value of
the derived type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;The characteristics
of the derived type are defined as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Each class of types that includes the parent type also
includes the derived type. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If the parent type is an elementary type or an array type,
then the set of possible values of the derived type is a copy of the
set of possible values of the parent type. For a scalar type, the base
range of the derived type is the same as that of the parent type. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If the parent type is a composite type other than an array
type, then the components, protected subprograms, and entries that are
declared for the derived type are as follows: </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC>The discriminants specified by a new <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT>,
if there is one; otherwise, each discriminant of the parent type (implicitly
declared in the same order with the same specifications) -- <A NAME="I1453"></A><A NAME="I1454"></A>in
the latter case, the discriminants are said to be <I>inherited</I>, or
if unknown in the parent, are also unknown in the derived type;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC>Each nondiscriminant component, entry, and protected subprogram
of the parent type, implicitly declared in the same order with the same
declarations; <A NAME="I1455"></A><A NAME="I1456"></A><A NAME="I1457"></A>these
components, entries, and protected subprograms are said to be <I>inherited</I>;
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC>Each component declared in a <FONT FACE="Arial, Helvetica">record_extension_part</FONT>,
if any. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<UL Class="Bulleted">Declarations of components, protected subprograms,
and entries, whether implicit or explicit, occur immediately within the
declarative region of the type, in the order indicated above, following
the parent <FONT FACE="Arial, Helvetica">subtype_indication</FONT>. </UL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The derived type is limited if and only if the parent type
is limited. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>For each predefined operator of the parent type, there
is a corresponding predefined operator of the derived type. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC><A NAME="I1458"></A>For each user-defined primitive subprogram
(other than a user-defined equality operator -- see below) of the parent
type that already exists at the place of the <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>,
there exists a corresponding <I>inherited</I> primitive subprogram of
the derived type with the same defining name. <A NAME="I1459"></A>Primitive
user-defined equality operators of the parent type are also inherited
by the derived type, except when the derived type is a nonlimited record
extension, and the inherited operator would have a profile that is type
conformant with the profile of the corresponding predefined equality
operator; in this case, the user-defined equality operator is not inherited,
but is rather incorporated into the implementation of the predefined
equality operator of the record extension (see <A HREF="RM-4-5-2.html">4.5.2</A>).
<A NAME="I1460"></A></LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<UL Class="Bulleted">The profile of an inherited subprogram (including
an inherited enumeration literal) is obtained from the profile of the
corresponding (user-defined) primitive subprogram of the parent type,
after systematic replacement of each subtype of its profile (see <A HREF="RM-6-1.html">6.1</A>)
that is of the parent type with a <I>corresponding subtype</I> of the
derived type. <A NAME="I1461"></A>For a given subtype of the parent type,
the corresponding subtype of the derived type is defined as follows:
</UL>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC>If the declaration of the derived type has neither a <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT>
nor a <FONT FACE="Arial, Helvetica">record_extension_part</FONT>, then
the corresponding subtype has a constraint that corresponds (as defined
above for the first subtype of the derived type) to that of the given
subtype.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC>If the derived type is a record extension, then the corresponding
subtype is the first subtype of the derived type.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<UL Class="NestedBulleted"><LI TYPE=DISC>If the derived type has a new <FONT FACE="Arial, Helvetica">known_discriminant_part</FONT>
but is not a record extension, then the corresponding subtype is constrained
to those values that when converted to the parent type belong to the
given subtype (see <A HREF="RM-4-6.html">4.6</A>). <A NAME="I1462"></A></LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<UL Class="Bulleted">The same formal parameters have <FONT FACE="Arial, Helvetica">default_expression</FONT>s
in the profile of the inherited subprogram. Any type mismatch due to
the systematic replacement of the parent type by the derived type is
handled as part of the normal type conversion associated with parameter
passing -- see <A HREF="RM-6-4-1.html">6.4.1</A>. </UL>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If a primitive subprogram of the parent type
is visible at the place of the <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>,
then the corresponding inherited subprogram is implicitly declared immediately
after the <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>.
Otherwise, the inherited subprogram is implicitly declared later or not
at all, as explained in <A HREF="RM-7-3-1.html">7.3.1</A>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1463"></A>A derived type can also be
defined by a <FONT FACE="Arial, Helvetica">private_extension_declaration</FONT>
(see <A HREF="RM-7-3.html">7.3</A>) or a <FONT FACE="Arial, Helvetica">formal_derived_type_definition</FONT>
(see <A HREF="RM-12-5-1.html">12.5.1</A>). Such a derived type is a partial
view of the corresponding full or actual type.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;All numeric types are derived types, in that
they are implicitly derived from a corresponding root numeric type (see
<A HREF="RM-3-5-4.html">3.5.4</A> and <A HREF="RM-3-5-6.html">3.5.6</A>).</DIV>

<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1464"></A>The elaboration of a <FONT FACE="Arial, Helvetica">derived_type_definition</FONT>
creates the derived type and its first subtype, and consists of the elaboration
of the <FONT FACE="Arial, Helvetica">subtype_indication</FONT> and the
<FONT FACE="Arial, Helvetica">record_extension_part</FONT>, if any. If
the <FONT FACE="Arial, Helvetica">subtype_indication</FONT> depends on
a discriminant, then only those expressions that do not depend on a discriminant
are evaluated.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I1465"></A>For the execution of a call
on an inherited subprogram, a call on the corresponding primitive subprogram
of the parent type is performed; the normal conversion of each actual
parameter to the subtype of the corresponding formal parameter (see <A HREF="RM-6-4-1.html">6.4.1</A>)
performs any necessary type conversion as well. If the result type of
the inherited subprogram is the derived type, the result of calling the
parent's subprogram is converted to the derived type. <A NAME="I1466"></A></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>10&nbsp;&nbsp;<A NAME="I1467"></A>Classes
are closed under derivation -- any class that contains a type also contains
its derivatives. Operations available for a given class of types are
available for the derived types in that class.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>11&nbsp;&nbsp;Evaluating an inherited
enumeration literal is equivalent to evaluating the corresponding enumeration
literal of the parent type, and then converting the result to the derived
type. This follows from their equivalence to parameterless functions.
<A NAME="I1468"></A></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>12&nbsp;&nbsp;A generic subprogram is
not a subprogram, and hence cannot be a primitive subprogram and cannot
be inherited by a derived type. On the other hand, an instance of a generic
subprogram can be a primitive subprogram, and hence can be inherited.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>13&nbsp;&nbsp;If the parent type is
an access type, then the parent and the derived type share the same storage
pool; there is a <B>null</B> access value for the derived type and it
is the implicit initial value for the type. See <A HREF="RM-3-10.html">3.10</A>.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>14&nbsp;&nbsp;If the parent type is
a boolean type, the predefined relational operators of the derived type
deliver a result of the predefined type Boolean (see <A HREF="RM-4-5-2.html">4.5.2</A>).
If the parent type is an integer type, the right operand of the predefined
exponentiation operator is of the predefined type Integer (see <A HREF="RM-4-5-6.html">4.5.6</A>).</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>15&nbsp;&nbsp;Any discriminants of the
parent type are either all inherited, or completely replaced with a new
set of discriminants.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>16&nbsp;&nbsp;For an inherited subprogram,
the subtype of a formal parameter of the derived type need not have any
value in common with the first subtype of the derived type. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>17&nbsp;&nbsp;If the reserved word <B>abstract</B>
is given in the declaration of a type, the type is abstract (see <A HREF="RM-3-9-3.html">3.9.3</A>).
</FONT></DIV>

<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;&nbsp;<I>Examples of
derived type declarations:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Local_Coordinate&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Coordinate;&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;two&nbsp;different&nbsp;types</I><BR>
<B>type</B>&nbsp;Midweek&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Day&nbsp;<B>range</B>&nbsp;Tue&nbsp;..&nbsp;Thu;&nbsp;&nbsp;<I>--&nbsp;&nbsp;see&nbsp;<A HREF="RM-3-5-1.html">3.5.1</A></I><BR>
<B>type</B>&nbsp;Counter&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Positive;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;same&nbsp;range&nbsp;as&nbsp;Positive&nbsp;</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B>&nbsp;Special_Key&nbsp;<B>is</B>&nbsp;<B>new</B>&nbsp;Key_Manager.Key;&nbsp;&nbsp;&nbsp;<I>--&nbsp;&nbsp;see&nbsp;<A HREF="RM-7-3-1.html">7.3.1</A></I><BR>
&nbsp;&nbsp;<I>--&nbsp;the&nbsp;inherited&nbsp;subprograms&nbsp;have&nbsp;the&nbsp;following&nbsp;specifications:&nbsp;</I><BR>
&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;Get_Key(K&nbsp;:&nbsp;out&nbsp;Special_Key);</I><BR>
&nbsp;&nbsp;<I>--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;&quot;&lt;&quot;(X,Y&nbsp;:&nbsp;Special_Key)&nbsp;return&nbsp;Boolean;</I></TT></DIV>

<HR>
<P><A HREF="RM-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-3-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-3-4-1.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="RM-TTL.html">Legal</A></P>
</BODY>
</HTML>