comp.lang.ada
 help / color / mirror / Atom feed
* Dispatching and Child Packages
@ 2001-03-21  0:12 Klatt, Nathan
  2001-03-21  6:53 ` Simon Wright
  2001-03-21  9:20 ` Peter Hend�n
  0 siblings, 2 replies; 3+ messages in thread
From: Klatt, Nathan @ 2001-03-21  0:12 UTC (permalink / raw)


Is it possible to dispatch from within a child package?  The below code does
not work.  If I collapse the child packages into their respective parents,
it dispatches as expected.  (Ndk is an empty package.)

Thanks,

Nathan Klatt

----------------------------------------------------------------------------
package Ndk.Base is

    type Base is abstract tagged null record;

end Ndk.Base;
----------------------------------------------------------------------------
package Ndk.Base.Child is

    procedure Do_Something (This : Base'Class);
    procedure Real_Do_Something (This : Base) is abstract;

end Ndk.Base.Child;
----------------------------------------------------------------------------
package body Ndk.Base.Child is

    procedure Do_Something (This : Base'Class) is
    begin
        Real_Do_Something (This);
    end Do_Something;

end Ndk.Base.Child;
----------------------------------------------------------------------------
with Ndk.Base;

package Ndk.Sub is

    type Sub is new
       Ndk.Base.Base with null record;

end Ndk.Sub;
----------------------------------------------------------------------------
package Ndk.Sub.Child is

    procedure Real_Do_Something (This : Sub);

end Ndk.Sub.Child;
----------------------------------------------------------------------------
with Ada.Text_Io;

package body Ndk.Sub.Child is

    procedure Real_Do_Something (This : Sub) is
    begin
        Ada.Text_Io.Put_Line ("Sub doing something...");
    end Real_To_String;

end Ndk.Sub.Child;
----------------------------------------------------------------------------

Compiler error:
Real_Do_Something (This); is a call on an abstract subprogram which should
be a dispatching call [RM_95 3.9.3(7)]

RM_95 3.9.3(7) says...
A call on an abstract subprogram shall be a dispatching call;
nondispatching calls to an abstract subprogram are not allowed.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-03-21  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-21  0:12 Dispatching and Child Packages Klatt, Nathan
2001-03-21  6:53 ` Simon Wright
2001-03-21  9:20 ` Peter Hend�n

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox