Section 12.5 - Access Parameters (For Object Orientation)

Often when developing object-oriented systems you will want to pass around access values to tagged types (we discussed tagged types in lesson 7). Ada 95 adds a new pseudo-mode called "access" to help you build OO systems using access types.

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"?

  1. Yes, Jump will dynamically dispatch.
  2. No, Jump will not dynamically dispatch.

You may also:

PREVIOUS Go back to the previous section

NEXT     Skip to the next section

OUTLINE  Go up to lesson 12 outline

David A. Wheeler (

The master copy of this file is at "".