Question.1
A GPIO class has two constructors:
class GPIO { int pin; public: GPIO() : pin(0) {} GPIO(int p) : pin(p) {} }; GPIO led; GPIO motor(9);
Which constructor is called for each?
Select Answer
Both call GPIO(int) -- led gets pin=0 by default
led calls GPIO() with pin=0; motor calls GPIO(int) with pin=9
Compilation error -- cannot have two constructors
Both call GPIO() -- the parameterized constructor is ignored