Home » U++ Library support » U++ Callbacks and Timers » "Function" question
"Function" question [message #47714] |
Thu, 09 March 2017 14:19 |
|
koldo
Messages: 3394 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
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 08:48:42 CEST 2024
Total time taken to generate the page: 0.03437 seconds
|