From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: [student] Help with generic procedures.
Date: 1998/05/23
Date: 1998-05-23T00:00:00+00:00 [thread overview]
Message-ID: <matthew_heaney-ya023680002305982250290001@news.ni.net> (raw)
In-Reply-To: 356793DA.820C4A50@iinet.net.au
In article <356793DA.820C4A50@iinet.net.au>, Oliver White
<ojw@iinet.net.au> wrote:
>> �� generic
>> ����� with procedure Process(O: Object_T);
>> ����� procedure Traverse(T: Tree);
>> ����� -- Visit each node and process it's data
>> ����� procedure Leaf_Traverse(T: Tree);
>> ����� -- Visit each leaf node and process it's data.
>>
>But when I compile the package body it doesn't recognise Process as a
>generic procedure of Leaf_Traverse. How would I rewrite this part of the
>spec to allow Leaf_Traverse to use the generic "Process"?
The way you've written it, it's very misleading. The issue is that you
really have
generic
with procedure Process (...);
procedure Traverse (T : Tree);
procedure Leaf_Traverse (T : Tree);
In other words, you've actually declared two different procedures, one
that's generic (Traverse), and one that's not (Leaf_Traverse).
Make up your mind about how many generic subprograms you want. If you want
two, then do this
generic
with procedure Process ...;
procedure Traverse (T : Tree);
generic
with procedure Process ...;
procedure Leaf_Traverse (T : Tree);
Matt
P.S. Can you get rid of all this gobbledygook below?
><HTML>
>I have this in my package spec:
><BR>
><BLOCKQUOTE TYPE=CITE>
><PRE> generic
> with procedure Process(O: Object_T);
> procedure Traverse(T: Tree);
> -- Visit each node and process it's data
> procedure Leaf_Traverse(T: Tree);
> -- Visit each leaf node and process it's
data.</PRE>
></BLOCKQUOTE>
>But when I compile the package body it doesn't recognise Process as a generic
>procedure of Leaf_Traverse. How would I rewrite this part of the spec to
>allow Leaf_Traverse to use the generic "Process"?<BR>
><BR>
><BR>I'm running on
><BR>Win 95, P133, 32MB RAM
><BR> </HTML>
>
>--------------8A52D5678832CDBEB46DE800--
next parent reply other threads:[~1998-05-23 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <356793DA.820C4A50@iinet.net.au>
1998-05-23 0:00 ` Matthew Heaney [this message]
1998-05-24 0:00 ` [student] Help with generic procedures Oliver White
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox