comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Ada: Inheritance of generics
Date: Mon, 02 Jun 2008 16:30:29 +0200
Date: 2008-06-02T16:30:29+02:00	[thread overview]
Message-ID: <48440405$0$6557$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <g20t5p$ptn$1@aioe.org>

Dennis Hoppe schrieb:
> Hi,
> 
> I managed to implement a generic parent class and create a generic unit, 
> which is a child of the first one. I wonder, why I have access to 
> procedures and functions of the parent class, if I am "within" the child 
> unit, but if I am "outside", the compiler complains that no selector for 
> a specified function exists.

Do you mean a parent type and a derived type which happen
to be declared in package templates?

The name "generic child package" has a meaning in Ada that
does not necessarily have something to do with types.
Just in case you are used to thinking in C++, a package
is not always the same as a class. For example, you can
have two types within the same package.

Only types, i.e. things declared using the resered word
"type", can  derive from other types. Likewise, a
package instance is made from a generic package which
acts as a template for packages. But packages are not types.
So this does not work:

package Child is new Parent.Object;


function Example return Integer;
is not associated with type Object; its profile does
not mention Object.
Function Example is somewhat like a static member function
in C++.


  -- Georg



      parent reply	other threads:[~2008-06-02 14:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02 13:39 Ada: Inheritance of generics Dennis Hoppe
2008-06-02 13:51 ` Dmitry A. Kazakov
2008-06-02 14:17   ` Dennis Hoppe
2008-06-02 14:34     ` Georg Bauhaus
2008-06-02 15:09     ` Dmitry A. Kazakov
2008-06-02 15:13     ` Adam Beneschan
2008-06-02 21:10       ` Dennis Hoppe
2008-06-02 14:30 ` Georg Bauhaus [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