comp.lang.ada
 help / color / mirror / Atom feed
From: Mats Weber <Mats.Weber@elca-matrix.ch>
Subject: Re: OOP & Packages in Ada
Date: 1998/01/31
Date: 1998-01-31T00:00:00+00:00	[thread overview]
Message-ID: <34D32AE3.87031F98@elca-matrix.ch> (raw)
In-Reply-To: 6asp37$q8b$1@Masala.CC.UH.EDU


> I've got a question for you.  Assuming we have two packages,
> say Parents and Children, and Children contains a type,
> Child, that is inherited from a type in Parents (Parents.Parent),
> is there a way to easily make all the methods of Parents.Parent
> available to Child, so that just with'ing the Children package will
> make these methods available?  Wrapper functions/procedures
> or renaming might do this, but is there an easier way?

Yes, there is. Do yourself a favor: go to <http://www.adahome.com>, look at
the books section, buy one, spend a day reading it, or look at one of the
tutorials (but don't even try learning from the Ada 95 RM). That way you will
learn how Ada 95's tagged types work and how to use them right. OOP in Ada 95
is a little different form what you have in other OO languages, and it's best
to learn before trying or you (or someone else) will have to maintain code
that is not written right.

> type Parent is tagged
>     record
>         ...
>     end record;
> 
> function  X (P : in Parent'Class) returns Integer;
> procedure Y (P : in out Parent'Class);
> procedure Z (P : out Parent'Class);

These are class-wide operations. It's probably not what you want.

Sorry for being so paternalistic :-)




  parent 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     ` Tom Moran
1998-02-01  0:00     ` Matthew Heaney
1998-02-02  0:00     ` Anonymous
1998-02-02  0:00     ` Jon S Anthony
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 [this message]
1998-01-31  0:00   ` Nick Roberts
replies disabled

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