199. Lambdas and Callback Management

Question.7

A class method uses a lambda that accesses member variables:

class Sensor {
   int pin;
public:
   Sensor(int p) : pin(p) {}
   void setup() {
       auto cb = [this]() {
            read_adc(this->pin);
       };
       register_callback(cb);
   }
};

What does [this] capture?

Need Help? Refer to the Quick Guide below

Select Answer