Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Problem with function pointers (c++)

Author: Steven Edwards

Date: 10:38:55 10/29/03

Go up one level in this thread


On October 29, 2003 at 09:50:23, Michel Langeveld wrote:

>I have a problem with casting function pointers between two classes.

There is no supported C++ way to do this directly.  Likewise, there is no way in
C++ to pass method pointers to directly use some C library functions that take
function pointers, like pthread_init() or qsort().

One way around this is to create a non-class funciton that acts as a proxy
between the caller and the method being called.  The proxy function is passed a
pointer to the target object and then calls the (usually) hard coded method name
for that object.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.