Attach function os c++

hello,

I am currently in laternance in an electronics company and I code in c++ on a mbed lpc 1768 and I must update the code that is already on it without modifying its functioning. however I have a problem with a bit of code currently the code in its old version looks like this

Serial pc(USBTX, USBRX); // USB_UART
SPI spi(p5, p6, p7); // MOSI, MISO, SCLK SPI
DigitalOut cs1(p18); // CS SPI
DigitalIn interupt(p19);

//
//-------------- End Pinout Mbed ------------------//
//
//

vector T_ASC_VAN;

void Rx_interrupt()
{
volatile int rx_in = 0;
int FlagNewTrame=0;

while (pc.readable()) {   
    rx_in = pc.getc();  
    if (FlagNewTrame == 1)
        T_ASC_VAN.push_back(rx_in); 
    if (rx_in == '#') {
        T_ASC_VAN.push_back(0xff); 
        int Nbyte=T_ASC_VAN.size();
        for (int i = 0; i < Nbyte; i++) 
            T_ASC_VAN.pop_back();
        FlagNewTrame = 1;
    }
    
    if (rx_in == '/') {
        pc.printf("lol");
        NVIC_SystemReset();
    }
}
return;

}

int main()
{
pc.baud(115200);
pc.attach(&Rx_interrupt, Serial::RxIrq);

wait(0.2);

}

to replace it I create a class called uart or I have a function that will make the interrupt and a function that makes the attach

void Uart::getUserInput()

{

printf("get input\n");

char c;

if (pc.read(&c, 1)) {

    if (c == '/') {

        printf("hello\n");

        ThisThread::sleep_for(chrono::milliseconds(10));

        NVIC_SystemReset();

    } 

}

}

void Uart::algo()

{

printf("algo\n");

pc.attach(callback(this, &Uart::getUserInput), SerialBase::RxIrq);

}

and when I call the algo function in my main I never go into the interruption focntion would you have a solution to make this attach properly or if it is not possible last resort another way of doing that will do the same.

int main( int ac, char** av)
{
Uart uart;

uart.initUartPort();


ThisThread::sleep_for(chrono::milliseconds(50));

uart.algo();

}

sorry for my english have good day