comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: OOP & Packages in Ada
Date: 1998/01/31
Date: 1998-01-31T00:00:00+00:00	[thread overview]
Message-ID: <01bd2ea0$ae551ae0$LocalHost@xhv46.dial.pipex.com> (raw)
In-Reply-To: 34D32AE3.87031F98@elca-matrix.ch


I would agree with Mats' advice, but, for the record, I think the answer to
your question is more or less as follows.

First, let's assume that there is a function X defined for type Parent in
package Parents as:

   function X (P: Parent) return Result_Type;

and another function X defined for type Child in package Children as:

   function X (C: Child) return Result_Type;

Programmers would then put something like

   with Parents.Children;

in front of their units which were going to use the type Child.  This
'with' clause makes the entities specified by Parents available as well as
those specified by Children.  So the function X which takes Parent as its
parameter would be available as well as the X which takes the type Child as
its parameter (but neither are directly visible, note).

Now, the programmer could either put

   use Parents, Children;

and then declare

   P: Parent;
   C: Child;

and then put

   Y := X(P);
   Z := X(C);

where the two calls to X will be resolved by overloading; or the programmer
could simply declare

   P: Parents.Parent;
   C: Children.Child;

and then put

   Y := Parents.X(P);
   Z := Children.X(C);

where the two calls to X are differentiated explicitly.

Perhaps the point is that the programmer _should_ have to make explicit
reference to the package Parents when using the type Parent, because that's
where it is declared.  If the type Child provides all the same
functionality of Parent (with, perhaps, more added), then the programmer is
using type Child all the time: type Parent remains unused -- it just
provides a 'baseline' from which other types are to be derived. 

-- 

== Nick Roberts ================================================
== Croydon, UK                       ===========================
==                                              ================
== Proprietor, ThoughtWing Software                   ==========
== Independent Software Development Consultant            ======
== Nick.Roberts@dial.pipex.com                              ====
== Voicemail & Fax +44 181-405 1124                          ===
==                                                            ==
==           I live not in myself, but I become               ==
===          Portion of that around me; and to me             ==
====         High mountains are a feeling, but the hum        ==
=======      Of human cities torture.
===========                             -- Byron [Childe Harold]





      reply	other threads:[~1998-01-31  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-30  0:00 OOP & Packages in Ada wanker
1998-01-31  0:00 ` Matthew Heaney
1998-02-01  0:00   ` wanker
1998-02-01  0:00     ` Matthew Heaney
1998-02-01  0:00     ` Tom Moran
1998-02-02  0:00     ` Jon S Anthony
1998-02-02  0:00     ` Anonymous
1998-02-03  0:00     ` John English
1998-02-04  0:00   ` Don Harrison
1998-02-04  0:00     ` Matthew Heaney
1998-02-05  0:00       ` Don Harrison
1998-02-06  0:00         ` Bob Collins
1998-01-31  0:00 ` Mats Weber
1998-01-31  0:00   ` Nick Roberts [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