|
![](/i/fill.gif) |
Warp wrote:
> Darren New <dne### [at] san rr com> wrote:
>> Actually, one place I think C++ style templates beat out generics is in this:
>
> Who are you and what have you done to our friend Darren?
Heh.
> You could store *pointers* to the objects in your container, but then you
> would end up with the same problem as in C# (if I understood correctly): You
> would have to decide the type of the pointer (which has to be the same for
> all the container elements).
That's a point I hadn't considered, yes.
Actually, I think that clued me in a bit. They *are* all of type "object". ;-)
So I could just have a list of objects, and when I get an update,
(dynamic)-cast each element to a IUpdatable and invoke that if it works;
when I get a draw, cast each to an IDrawable and invoke that if it works, etc.
Ugly, but it'll do the trick, I think.
I still don't want to implement all the other mechanics going on there, and
I *do* want to implement somewhat different mechanics to make things more
self-contained. (As it stands, for example, there's no good place to "add
yourself to the list" during initialization. The object that is creating you
has to add you to the list of objects it knows about, which is inconvenient
in some ways.)
Anyway, maybe I'll grope thru the brand new 4.0 release and see what they
have there. They really changing a bunch of this sort of stuff around each
release, while leaving the basic underlying drawing calls alone, so maybe
they realized people need more support for the kind of problem I'm trying to
solve.
--
Darren New, San Diego CA, USA (PST)
Yes, we're traveling together,
but to different destinations.
Post a reply to this message
|
![](/i/fill.gif) |