103. Destructors-I

Question.1

An LED class turns on in the constructor and off in the destructor:

class LED {
   int pin;
public:
   LED(int p) : pin(p) { gpio_set(pin, HIGH); }
   ~LED() { gpio_set(pin, LOW); }
};

void blink() {
   LED led(13);  // LED ON
   delay(100);
} // LED OFF

When does the LED turn off?

Need Help? Refer to the Quick Guide below

Select Answer