* Re: [student] Help with generic procedures.
[not found] <356793DA.820C4A50@iinet.net.au>
@ 1998-05-23 0:00 ` Matthew Heaney
1998-05-24 0:00 ` Oliver White
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Heaney @ 1998-05-23 0:00 UTC (permalink / raw)
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--
^ permalink raw reply [flat|nested] 2+ messages in thread