Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Callbacks and Timers » "Function" question
"Function" question [message #47714] Thu, 09 March 2017 14:19 Go to previous message
koldo is currently offline  koldo
Messages: 3356
Registered: August 2008
Senior Veteran
Hello all

I wanted to assign a Function from a subclass but compiler complains with error:

'&': illegal operation on bound member function expression

What have I to do?
class FuncSource {
protected:
	Function <double(double)> function;

public:
	FuncSource(Function <double(double)> function) : function(function) {}
	double f(double x)	{return function(x);}
};

class MySource : public FuncSource {
public:
	MySource(double data) : FuncSource(&Calc), data(data) {}  // COMPILER ERROR
	
	double Calc(double x) {return x + data/10;}
	
private:
	double data;
};


Best regards
IƱaki

[Updated on: Thu, 09 March 2017 14:19]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: Event.execute
Next Topic: PostCallback in constructor
Goto Forum:
  


Current Time: Sat Apr 20 08:45:33 CEST 2024

Total time taken to generate the page: 0.03388 seconds