comp.lang.ada
 help / color / mirror / Atom feed
* 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>&nbsp;
><BLOCKQUOTE TYPE=CITE>
><PRE>&nbsp;&nbsp; generic
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with procedure Process(O: Object_T);
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procedure Traverse(T: Tree);
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Visit each node and process it's data
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; procedure Leaf_Traverse(T: Tree);
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- 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>&nbsp;</HTML>
>
>--------------8A52D5678832CDBEB46DE800--




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [student] Help with generic procedures.
  1998-05-23  0:00 ` [student] Help with generic procedures Matthew Heaney
@ 1998-05-24  0:00   ` Oliver White
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver White @ 1998-05-24  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=x-user-defined, Size: 65 bytes --]


ahh thanks, sorry the quotation came out like that.
�
�





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-05-24  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <356793DA.820C4A50@iinet.net.au>
1998-05-23  0:00 ` [student] Help with generic procedures Matthew Heaney
1998-05-24  0:00   ` Oliver White

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