25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<strong>VDM</strong>-<strong>10</strong> <strong>Language</strong> <strong>Manual</strong><br />

CPU1.deploy(a);<br />

-- deploy b on CPU1<br />

CPU1.deploy(b);<br />

-- deploy c on CPU2<br />

CPU2.deploy(c,"CT");<br />

-- "CT" is a label here which is ignored<br />

);<br />

end Simple<br />

✡✝<br />

✆<br />

where A, B and C all are defined as classes.<br />

14.2 Classes<br />

Compared to the standard <strong>VDM</strong>-SL language, <strong>VDM</strong>++ and <strong>VDM</strong>-RT have been extended with<br />

classes. In this section, the use of classes to create and structure a top-level specification will be<br />

described. With the object oriented facilities offered by <strong>VDM</strong>++ and <strong>VDM</strong>-RT it is possible to:<br />

• Define classes and create objects.<br />

• Define associations and create links between objects.<br />

• Make generalisation and specialisation through inheritance.<br />

• Describe the functional behaviour of the objects using functions and operations.<br />

• Describe the dynamic behaviour of the system through threads and synchronisation constraints.<br />

Before the actual facilities are described, the general layout of a class is described.<br />

Syntax: class = ‘class’, identifier, [ inheritance clause ],<br />

[ class body ],<br />

‘end’, identifier ;<br />

inheritance clause = ‘is subclass of’, identifier, ‘,’, { identifier } ;<br />

class body = definition block, { definition block } ;<br />

definition block = type definitions<br />

| value definitions<br />

| function definitions<br />

| operation definitions<br />

128

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

Saved successfully!

Ooh no, something went wrong!