visual c++ - C++ Function Pointer Syntax -


I am trying to create a function in VC ++ which takes the function pointer, but I keep the syntax errors .

The declaration in my header file looks like this:

  Apply zero to fit Select (zero (* function) (CPoint, * CSpreadWnd));  

Here's the definition:

  Zero CspreadWind :: Apply FitConference Selection (Zero (* function) (CPoint, * CSpreadWnd)) {... }  

and receiving error messages here:

  c: \ ... \ spreadwnd.h (274): error C2059: syntax error : 'Function-style cast' c: \ ... \ spreadwnd.h (274): Error C2059: Syntax Error: ')' c: \ ... \ spreadwnd.h (274): Error C2143: Syntax Error: Missing ')' first ';'  

I know that its probably something really simple that I am missing but I can not find this.

This is usually a good idea to define a type-tof for your function pointer type is. It helps in using it in more announcements, and when you write an error, then it has to be changed twice. Here, you put an asterisk on the wrong side of CSpreadWnd .

  typingfide (* MyFuncPtr) (CPoint, CSpreadWND *); Apply zero to fit Select (MyFuncPtr func);  

More definition:

  Zero CspreadWind :: Apply Fit to RetailCell (MyFuncPtr func) {...}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -