Function pointers with default parameters in C++

Both foo() and bar() can only be assigned to func_ptr2.

ยง8.3.6/2:

A default argument is not part of the type of a function. [Example:

int f(int = 0);

void h() {
    int j = f(1);
    int k = f(); // OK, means f(0)
}

int (*p1)(int) = &f; 
int (*p2)() = &f; // error: type mismatch

–end example]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)