Mail Archives: djgpp/2001/04/30/08:28:57
Hentie Louw <13080555 AT narga DOT sun DOT ac DOT za> wrote:
> This requires me to use pointers to procedures. It would do wonders for my
> code if I could have pointers to methods in my classes, but I can't seem to
> do it. Is it possible?
Yes. But without wrapper functions, as you currently already do it,
you have to use a special C++ syntax to reinterpret a method pointer
as a function pointer, or you have to restrict yourself to static
methods. The difference is the hidden 'this' argument --- static
methods don't have it, and thus behave more like classical C
functions.
Generally spoken, function pointers are rather alien to an OO type
language like C++. You would usually use subclassing, instead.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -