Attribute Super (GNAT Reference Manual) (original) (raw)
17.3.3 Attribute Super ¶
The Super
attribute can be applied to objects of tagged types in order to obtain a view conversion to the most immediate specific parent type.
It cannot be applied to objects of types without any ancestors.
type T1 is tagged null record; procedure P (V : T1);
type T2 is new T1 with null record;
type T3 is new T2 with null record; procedure P (V : T3);
procedure Call ( V1 : T1'Class; V2 : T2'Class; V3 : T3'Class) is begin V1'Super.P; -- Illegal call as T1 doesn't have any ancestors V2'Super.P; -- Equivalent to "T1 (V).P;", a non-dispatching call -- to T1's primitive procedure P. V3'Super.P; -- Equivalent to "T2 (V).P;"; Since T2 doesn't -- override P, a non-dispatching call to T1.P is -- executed. end;