I'm doing a program for arduino written in C ++ to turn on and off leds when a button is pressed. I created a class Led and put the methods in it, now I wrote an if that checks when a button is pressed, however I want it when the if verify that the button was pressed it automatically passes the led referring to the button as for the method. Something like that.
if(digitalRead(led1.botão || led2.botão) == 0) { // verifica se algum botão foi pressionado
"Ledpressionado".ligar(); // seleciona o led referente ao botão pressionado
In java this happens automatically with the use of this, but in c ++ it does not.