Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> > What if you want to call the function (through the pointer) for different
> > objects?
> I can't think of a convenient way offhand to do this in C#. I think here
> you'd likely fall back to a fixed-named function and then subclass objects
> (or inherit from interfaces) to do that.
But the whole idea with function pointers is that you can call different
functions (which have the same signature) from the same code.
In C++ templates have mostly replaced the need for this (or at least made
it way easier in syntax), but not completely.
--
- Warp
Post a reply to this message
|