From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: What is derived?
Date: Sun, 03 Oct 2004 18:54:45 +0200
Date: 2004-10-03T18:54:45+02:00 [thread overview]
Message-ID: <3010113.uZPRfhq3jA@linux1.krischik.com> (raw)
In-Reply-To: cjn8nv$h92$04$1@news.t-online.com
Rick Santa-Cruz wrote:
> Hi,
>
> thanks for your answer!
>
>>> At least I think, that private-methods are inherited, or am I wrong?
>>
>> If by "private-methods" you mean "subprograms declared in the private
>> part of the package spec", then yes and no. They will be derived if
>> they are visible at the point of derivation.
> What do you mean with visible at the point of deriviation? For example if
> a procedure is declared after the a type is derived, then is this
> procedure not visible? Are there more special cases?
Remember that private work on child packages and not on child classes.
So a child class which is inside a child packages can see procedures
declared inside private.
A child class declared in an unrelated package can not see the private part
and therefore cannot inherit private procedures.
If you are a C++ convert then I suggest to declare all child classes in
child packages - that make transition easier for you
With Regards
Martin.
PS: The following creates a class where the outsild world does not know it
is OO. Favourite example is Unbounded_String. Since Unbounded_String may
not leak memory and almost no Ada compiler implements garbage collection it
needs some form of destructor. Therefore Unbounded_String is internally a
class.
package Hidden_Tag
type Object is private;
private
type Object is tagged private;
end Hidden_Tag;
--
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
prev parent reply other threads:[~2004-10-03 16:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-02 16:15 What is derived? Rick Santa-Cruz
2004-10-02 21:30 ` Stephen Leake
2004-10-02 22:02 ` Rick Santa-Cruz
2004-10-03 16:54 ` Martin Krischik [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