18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

xx<br />

<strong>Object</strong><br />

Preface<br />

An <strong>in</strong>stance of a class. An object has a state that is <strong>in</strong>terrogated / changed by<br />

methods <strong>in</strong> the class. The object mike that is an <strong>in</strong>stance of Account is<br />

declared as follows:<br />

Mike: Account;<br />

Overload<strong>in</strong>g<br />

When an identifier can have several different mean<strong>in</strong>gs. For example, the<br />

procedure Put <strong>in</strong> the package <strong>Ada</strong>.Text_Io has several different<br />

mean<strong>in</strong>gs. Output an <strong>in</strong>stance of a Character, output an <strong>in</strong>stance of a<br />

Str<strong>in</strong>g.<br />

Put("Hello Worl"); Put('d' );<br />

Overrid<strong>in</strong>g<br />

Polymorphism<br />

The ability to send a message to an object whose type is not known at<br />

compile-time. The method selected depends on the type of the receiv<strong>in</strong>g<br />

object. For example the message 'Display' is sent to different types of<br />

picture elements that are held <strong>in</strong> an array.<br />

Display( Picture_Element(I) );<br />

Rendezvous<br />

Representation<br />

clause<br />

The <strong>in</strong>teraction that occurs when two tasks meet to synchronize and possibly<br />

exchange <strong>in</strong>formation.<br />

Directs the compiler to map a program item onto specific hardware features<br />

of a mach<strong>in</strong>e. For example, location is def<strong>in</strong>ed to be at address<br />

16#046C#.<br />

Mc_Address : constant Address :=<br />

To_Address( 16#046C# );<br />

Location : Integer;<br />

for Location'Address use Mc_Address;<br />

Static b<strong>in</strong>d<strong>in</strong>g<br />

Type<br />

The b<strong>in</strong>d<strong>in</strong>g between an object and the message that it is sent to it is known<br />

at compile-time.<br />

A type def<strong>in</strong>es a set of values and the operations that may be performed on<br />

those values. For example, the type Exam_Mark def<strong>in</strong>es the values that may<br />

be given for an exam <strong>in</strong> English.<br />

type Exam_Mark is range 0 .. 100;<br />

English : Exam_Mark<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!