AdaPower Logged in as Guest
Ada Tools and Resources

Ada 95 Reference Manual
Ada Source Code Treasury
Bindings and Packages
Ada FAQ


Join >
Articles >
Ada FAQ >
Getting Started >
Home >
Books & Tutorials >
Source Treasury >
Packages for Reuse >
Latest Additions >
Ada Projects >
Press Releases >
Ada Audio / Video >
Home Pages >
Links >
Contact >
About >
Login >
Back
Can you access super methods?

Do you mean "call the operation of the type's parent"?

The answer is yes, by converting the object to the parent type, and then invoking the operation.

For example, suppose I have some special kind of bounded stack:

generic
package Stacks.Bounded_G.Special_G is

  type Stack_Type is new Bounded_G.Stack_Type with private;

  procedure Push (...);

end;

-- instantiate the special stack package --

Now let's call the parent Push operation:

 declare
   Stack : Integer_Stacks.Bounded.Special.Stack_Type;
 begin
   Push (1234, On => Bounded.Stack_Type (Stack));
   ...
 end;

Even though the Stack object is of specific type Special.Stack_Type, which has its own version of Push, the Push operation of its parent is invoked.

No, Ada95 does not have a way to say "invoke my parent's operation."

(Matthew Heaney)


(c) 1998-2004 All Rights Reserved David Botton