comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to access parent class/object?
Date: Fri, 25 Mar 2005 08:48:24 +0100
Date: 2005-03-25T08:48:19+01:00	[thread overview]
Message-ID: <1a1i0bsj6w543.qanvlsnuodfy$.dlg@40tude.net> (raw)
In-Reply-To: 1111733830.271744.235420@f14g2000cwb.googlegroups.com

On 24 Mar 2005 22:57:10 -0800, Adrian Hoe wrote:

> Hi,
> 
> I have the following codes (abbreviated):
> 
> package A is
>    type A_Object is tagged private;
> ...
> end A;
> 
> package B is
>    type B_Object is new A_Object with private;
> ...
> end B;
> 
> package C is
>    type C_Object is new B_Object with private;
> ...
> end C;
> 
> package D is
>    type D_Object is new C_Object with private;
> ...
> end D;
> 
> Now, I have the following declaration:
> 
> My_D_Object is D.D_Object;
> 
> How can I reference the parent objects?
> 
> procedure Process_C (C_Obj : access C_Object);
> procedure Process_D (D_Obj : access D_Object);
> 
> How can I pass C_Object and D_Object into Process_C and Process_D
> respectively given only My_D_Object is D.D_Object?

   My_D_Object : aliased D_Object := ...;

   Process_C (C_Object (My_D_Object)'Access);
   Process_D (My_D_Object'Access);

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-03-25  7:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-25  6:57 How to access parent class/object? Adrian Hoe
2005-03-25  7:48 ` Dmitry A. Kazakov [this message]
2005-03-25  8:10   ` Adrian Hoe
2005-03-25  8:08 ` Adrian Hoe
2005-03-25  8:08 ` Adrian Hoe
replies disabled

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