jeudi 23 septembre 2021

Make a function has higher precedence than another

So I have a function:

void foo(char a = 'A', int b = 0)
{
    // code
}

And I have another one:

void foo(int b = 0, char a = 'A')
{
    //code
}

Then if I call foo(), it will return an error because the compiler can't decide which function to call. So can I make a function that has higher precedence than another? So if I call foo() then the compiler which one to choose?

Aucun commentaire:

Enregistrer un commentaire