how to let a global function pointer point to a function in a Class 
Author Message
 how to let a global function pointer point to a function in a Class

Something like that,
extern  void  (*get_frequency)( int oref,   int l_frequency);
class TuneDlg : public CDialog
{
public:
 TuneDlg(CWnd* pParent = NULL);   // standard constructor
 enum { IDD = IDD_TUNE };
 protected:
 virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
void GetFrequency( int oref,   int l_frequency);
 DECLARE_MESSAGE_MAP()

Quote:
};

get_frequency=GetFrequency;

I get a error, "can not covert void* to TuneDlg::*.



Tue, 06 May 2003 03:00:00 GMT  
 how to let a global function pointer point to a function in a Class
you need to declare the get_frequency type as a pointer-to-member-function
rather than pointer-to-function (they have different syntax and semantics).
--
Roger Onslow
Software Developer
See my articles at http://www.codeguru.com
See the product I am working on at http://www.swishzone.com

"Operator .. give me the number for 911" .. Homer Simpson


Quote:
> Something like that,
> extern  void  (*get_frequency)( int oref,   int l_frequency);
> class TuneDlg : public CDialog
> {
> public:
>  TuneDlg(CWnd* pParent = NULL);   // standard constructor
>  enum { IDD = IDD_TUNE };
>  protected:
>  virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
> void GetFrequency( int oref,   int l_frequency);
>  DECLARE_MESSAGE_MAP()
> };

> get_frequency=GetFrequency;

> I get a error, "can not covert void* to TuneDlg::*.



Tue, 06 May 2003 03:00:00 GMT  
 how to let a global function pointer point to a function in a Class
Hi,

declare  GetFrecuency() as static member of TuneDlg:

class Tu...
{
     static void GetFrequency( int oref,   int l_frequency);

Quote:
}

then you can use everywhere using this syntax:

    TuneDlg::GetFrecuency(10,100);

Quote:



> > Something like that,
> > extern  void  (*get_frequency)( int oref,   int l_frequency);
> > class TuneDlg : public CDialog
> > {
> > public:
> >  TuneDlg(CWnd* pParent = NULL);   // standard constructor
> >  enum { IDD = IDD_TUNE };
> >  protected:
> >  virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
> > void GetFrequency( int oref,   int l_frequency);
> >  DECLARE_MESSAGE_MAP()
> > };

> > get_frequency=GetFrequency;

> > I get a error, "can not covert void* to TuneDlg::*.



Fri, 09 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to use (pointer to function), and function and pointer to (pointer to function)

2. Function pointer pointing to a different function type

3. Class function pointer does not evaluate to a function

4. function pointers to functions in classes.

5. Function pointer to function inside class

6. How to define a pointer that point to a function pointers buffer

7. Pointer Functions and Pointers to Pointer Functions

8. Question about signal()/pointers to functions that return pointers to functions

9. function pointers and function pointers array

10. C++ function pointers versus C function pointer problem

11. Pointer to function returning pointer to function returning...

12. How to initialize a global function pointer?

 

 
Powered by phpBB® Forum Software