I wrote a program that uses a normal Serial port and a Bluetooth Serial Port to send logs to UART and Bluetooth respectively
HardwareSerial Serial;
BluetoothSerial SerialBT;
for example when i want to send something with them i write this
Serial.println("Hello World"); //prints Hello world in normal Serial port
SerialBT.println("Hello World"); // prints Hello World in Bluetooth serial
i defined some preprocessors that checks whether Bluetooth or Normal Serial port is active and if one of them is active print in the active one
my problem is here that i want to declare a variable like "Debugger" that i can assign it with "SerialBT" or "Serial" to write something like this
somewere in my init function
#if BLUETOOTHDEBUG
Debugger=&SerialBT;
#else
Debugger=&Serial;
#endif
and in code
Debbugger->println("Hello World")
instead of using if in whole code
Stream &Debuggershould work just fine?class Bandclass Cboth inherit fromclass A, thenA *a = new B()will work; likewise, if you haveB b, thenA *a = &bwill as well.