If you recall, every parameter for a subprogram has to be of mode in, in out, or out. You can use the keyword "access" as a mode (followed by a type name) instead. Here's an example:
procedure Get(Agent : access Occupant; Direct_Object : access Occupant'Class);
So what in the world does this example mean?? Here's the answer:
There's an important requirement for access parameters - null values are not permitted. If you want to permit null values, use the modes in, out, or in out with an ordinary access type.
It's difficult to understand access parameters without more context, so we'll defer discussing this further until lesson 18 where we will look at examples of this. What you need to understand right now is that if you're using access types and object-oriented programming, you will probably want to use the pseudomode "access".
Given the following procedure declaration:
procedure Jump(E : access Occupant'Class);
Will a call to procedure Jump dynamically dispatch to one of many subprograms depending on the exact type of "E"?
|Go back to the previous section||Skip to the next section||Go up to lesson 12 outline|
David A. Wheeler (email@example.com)
The master copy of this file is at
The master copy of this file is at "http://www.adahome.com/Tutorials/Lovelace/s12s5.htm".