Click here to Skip to main content
15,897,718 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Application Instance Pin
john563214-Apr-08 1:14
john563214-Apr-08 1:14 
AnswerRe: Application Instance Pin
Rajesh R Subramanian14-Apr-08 1:20
professionalRajesh R Subramanian14-Apr-08 1:20 
GeneralRe: Application Instance Pin
john563214-Apr-08 1:49
john563214-Apr-08 1:49 
QuestionRe: Application Instance Pin
Rajkumar R14-Apr-08 1:34
Rajkumar R14-Apr-08 1:34 
GeneralRe: Application Instance Pin
Rajesh R Subramanian14-Apr-08 1:44
professionalRajesh R Subramanian14-Apr-08 1:44 
QuestionRe: Application Instance Pin
David Crow14-Apr-08 3:59
David Crow14-Apr-08 3:59 
GeneralRe: Application Instance Pin
JudyL_MD14-Apr-08 1:47
JudyL_MD14-Apr-08 1:47 
QuestionMember function pointer Pin
johanlich14-Apr-08 0:07
johanlich14-Apr-08 0:07 
Hello.

I’m working on a Class that is going to solve a couple of equations.
My Visual Studio 2005 project contains two solutions.
-My Class (and a simple interface for testing)
-A general math library

I use a equation-solver from the general library, and it has a function pointer as one of its inputs. After some intense googeling I came up with the following code:

<br />
// H-file<br />
class MyClass{<br />
<br />
private:<br />
	typedef double (MyClass::*FunctionPtr)(double x);<br />
	double Equation(double x);<br />
	double MyFunction(double x,double x1,double x2);<br />
};<br />
<br />
// cpp-file<br />
double MyClass::Equation(double x)<br />
{<br />
	return x*x; // Test equation<br />
}<br />
double MyClass:MyFunction(double x,double x1,double x2)<br />
{<br />
	double result = 0;<br />
<br />
	FunctionPtr ptr;<br />
	ptr = &MyClass::Equation;<br />
<br />
	// Return where f(x) = 0 within x1 -> x2<br />
	result = EquationSolver(x1,x2,(this->*ptr)(x)); // <- Error here<br />
<br />
	return result;<br />
}<br />
<br />
// function in another solution<br />
double EquationSolver(double x1,double x2, double (*func)(double));<br />


But when I run the code I get the following error message (when I call the EquationSolver):
error C2664: 'EquationSolver' : cannot convert parameter 3 from 'double' to 'double (__cdecl *)(double)'

I have no clue how to solve this error. Can someone smarter than me help pointing me in the right direction? Confused | :confused:
GeneralRe: Member function pointer Pin
CPallini14-Apr-08 0:22
mveCPallini14-Apr-08 0:22 
GeneralRe: Member function pointer Pin
Rajkumar R14-Apr-08 0:31
Rajkumar R14-Apr-08 0:31 
GeneralRe: Member function pointer Pin
johanlich14-Apr-08 2:25
johanlich14-Apr-08 2:25 
QuestionHow I know when the "lineMakeCall" function finish Pin
yytg13-Apr-08 23:24
yytg13-Apr-08 23:24 
QuestionWin CE 5.0: Is it posible to send SMSes via the RAS-Phone API? Pin
Klive813-Apr-08 22:20
Klive813-Apr-08 22:20 
General[Message Deleted] Pin
nisha0000013-Apr-08 22:06
nisha0000013-Apr-08 22:06 
AnswerRe: An Usual Question Pin
Rajesh R Subramanian13-Apr-08 22:14
professionalRajesh R Subramanian13-Apr-08 22:14 
GeneralRe: An Usual Question Pin
Mukesh Kumar13-Apr-08 22:26
Mukesh Kumar13-Apr-08 22:26 
GeneralRe: An Usual Question Pin
ThatsAlok19-Jun-09 0:23
ThatsAlok19-Jun-09 0:23 
GeneralRe: An Usual Question Pin
CPallini13-Apr-08 23:17
mveCPallini13-Apr-08 23:17 
GeneralRe: [Message Deleted] Pin
vijay_aroli14-Apr-08 0:13
vijay_aroli14-Apr-08 0:13 
GeneralRe: [Message Deleted] Pin
Rajkumar R14-Apr-08 0:57
Rajkumar R14-Apr-08 0:57 
JokeRe: [Message Deleted] Pin
Rajesh R Subramanian14-Apr-08 1:01
professionalRajesh R Subramanian14-Apr-08 1:01 
GeneralRe: [Message Deleted] Pin
Rajkumar R14-Apr-08 1:05
Rajkumar R14-Apr-08 1:05 
GeneralRe: [Message Deleted] Pin
nisha0000014-Apr-08 1:57
nisha0000014-Apr-08 1:57 
GeneralRe: [Message Deleted] Pin
Hamid_RT14-Apr-08 20:09
Hamid_RT14-Apr-08 20:09 
Question__timeb64 function Pin
rp_suman13-Apr-08 21:59
rp_suman13-Apr-08 21:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.