Gripporillat
Well-known member
Hi everybody!
I'm trying to create a no-arguments-provided-version of a class constructor, this is my code:
and this is the error message:
Your help will be highly appreciated!
Robert
P.S.: You can find the whole project in the .zip file
I'm trying to create a no-arguments-provided-version of a class constructor, this is my code:
Code:
//empty Constructor
SkyFlash::SkyFlash(): poti(SkyPoti()), bounce(0, 0) {
}
//Constructor
SkyFlash::SkyFlash(SkyPoti& Poti, int pin) : poti(Poti), bounce(pin, 10) {
pinMode(pin, INPUT_PULLUP);
}
and this is the error message:
Arduino: 1.8.8 (Windows 10), TD: 1.45, Board: "Teensy 3.5, MIDI, 120 MHz, Faster, US English"
...\libraries\SkyController\SkyFlash.cpp: In constructor 'SkyFlash::SkyFlash()':
...\libraries\SkyController\SkyFlash.cpp:7:51: error: invalid initialization of non-const reference of type 'SkyPoti&' from an rvalue of type 'SkyPoti'
SkyFlash::SkyFlash(): poti(SkyPoti()), bounce(0, 0) {
^
Your help will be highly appreciated!
Robert
P.S.: You can find the whole project in the .zip file