Access

The Solar_System API is still not working

The purpose of this exercise is to use Access types to avoid passing Bodies as in out everywhere.

_images/05_1.png

Expected result

Question 1

Define a type Body_Access_T as an access type to all Body_T.

Question 2

Implement Get_Body as defined in the specification of the Solar_System package.

Use 'Access to return the access to the expected body.

Question 3

Modify Init_Body procedure as defined in the specification of the Solar_System package.

Update initialization calls in the Main procedure.

Question 4

Modify the Turns_Around field of Body_T type to be a Body_Access_T.

Question 5

Modify Move procedure as defined in the specification of the Solar_System package.

It’s compiling now!

Question 6

What is the problem with accessibility check? Try to fix it.

Question 7

How can usage of 'Unchecked_Access be avoided?