I've this base class:
class Task {
private:
    bool enabled;
    void (*foo)();
public:
    virtual void init(int period) { enabled = true; }
    virtual void tick() = 0;
    void high(void (*f)()) { foo = f; }
    void callFoo() { foo(); }
    bool isEnabled() { return enabled; }
};
and a class which implements Task with this method:
LedTask::LedTask(int pin, Context* pContext) {
    this->pin = pin;
    this->pContext = pContext;
}
void LedTask::init(int period) {
    Task::init(period);
    this->led = new Led(pin);
}
void LedTask::tick() {
    Task::callFoo();
}
in main():
Task* t3 = new LedTask(LED_PIN, c);
t3->init(50);
t3->high([]{Serial.println("ok");});
This works but I'd like to know how to access private (and public) member of t3 instance; something like:
t3->high([]{ led->switchOn(); });
In short, I want to inject a function in a class and use its class members in it.
 
    