comp.lang.ada
 help / color / mirror / Atom feed
From: Ed Falis <efalis@mediaone.net>
Subject: Re: When to use 'Class in a parameter list
Date: Tue, 24 Jul 2001 14:36:02 GMT
Date: 2001-07-24T14:36:02+00:00	[thread overview]
Message-ID: <3B5D8819.E9D8AD4E@mediaone.net> (raw)
In-Reply-To: 9jjr39$o3l$1@nh.pace.co.uk

Marin David Condic wrote:
> 
> O.K. I think I've got my brain straight about that - maybe the type
> conversion that I thought I needed only needed to occur within the child
> package in order to force a call back to its parent routine. (Resolving an
> otherwise ambiguous call.)
> 
> But that still leaves me a bit confused about when I want to make a
> parameter of 'Class.

There are two situations I find useful for using classwide parameters.

The first is when I want to force that the implementation of a routine
will not be overridden by derived type.

The second is for implementing a "template pattern", where some overall
processing is applied regardless of the specific type of the parameter,
and dispatching is used within the routine to handle variation among
specific types.  For instance, when traversing a tree, certain steps are
applied to all nodes, whether internal or leaf, while others depend on
the status of the node (composite pattern).  So here the traversal
operation would use a classwide parameter, while the action applied
within it, would dispatch.

- Ed



  reply	other threads:[~2001-07-24 14:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 20:27 When to use 'Class in a parameter list Marin David Condic
2001-07-23 21:39 ` Ehud Lamm
2001-07-24 12:49   ` Marin David Condic
2001-07-24 14:39     ` Dmitry A. Kazakov
2001-07-24 15:16     ` Ehud Lamm
2001-07-24 17:16       ` Marin David Condic
2001-07-23 22:55 ` Stephen Leake
2001-07-25 19:20   ` Deligation with Ada95 Hans-Olof Danielsson
2001-07-26  2:06     ` Lao Xiao Hai
2001-07-24  2:22 ` When to use 'Class in a parameter list Vincent Marciante
2001-07-24 12:52   ` Marin David Condic
2001-07-24 14:36     ` Ed Falis [this message]
2001-07-24 15:29       ` Ehud Lamm
2001-10-29 22:52 ` Matthew Heaney
replies disabled

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