comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Lorentzon <emwson@emw.ericsson.se>
Subject: Re: Dynamic dispatch and calling parent
Date: 1996/10/23
Date: 1996-10-23T00:00:00+00:00	[thread overview]
Message-ID: <vmsp75ewe4.fsf@emw.ericsson.se> (raw)
In-Reply-To: m2k9si6wnp.fsf@metronet.com


>>>>> "Corey" == Corey Minyard <minyard@metronet.com> writes:

    Corey> I am trying to create a dynamically dispached function.  I
    Corey> want the function for the child type to be able to call the
    Corey> parent's function much like you can in Java, Oberon-2, C++,
    Corey> etc.

package root is

   type parent is tagged private;

   procedure foo(this : in parent);

private

   type parent is tagged null record;

end root;
------------------------------------------------------------
package root.child is

   type derived is new parent with private;

   procedure foo(this : in derived);

private

  type derived is new parent with null record;

end root.child;
------------------------------------------------------------
package body root.child is

  procedure foo(this : in derived)
  is
  begin

    -- Call the parent's operation by casting the type
    foo(root.parent(this));

    -- Do some operations on your own
    null;
  end foo;

end root.child;




      reply	other threads:[~1996-10-23  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-23  0:00 Dynamic dispatch and calling parent Corey Minyard
1996-10-23  0:00 ` Martin Lorentzon [this message]
replies disabled

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