|
 |
Darren New wrote:
> Actually, one place I think C++ style templates beat out generics is in
> this:
As I've written before, AFAIK these are two entirely unrelated
technologies that do totally different things.
> In MS's simple game libraries, there's a class called GameComponent.
> It inherits from IUpdatable, IDrawable, and IMumble, each of which
> provides the declaration of one of the main routines in a game (update,
> draw, and initialize, respectively).
>
> Now, if I wanted (and I do) to make a collection of things that act like
> GameComponent objects but aren't necessarily game components, I don't
> think I can do that in C#. I would have to have a collection
> parameterized on all three of those interfaces. GameComponent supports a
> bunch of things that i might not want to have to support, but I can't
> make a collection that'll let me add "anything with those three
> routines, including GameComponent."
Heh, just use a language that has first-class functions, and store a
collection of functions. ;-)
Post a reply to this message
|
 |