nullptr :
In c++ NULL value is integer 0, hence leads to an ambiguity when we invoke below function.
void foo(int i) { cout << "foo_int" << endl; }
void foo(char* pc) { cout << "foo_char*" << endl; }
int main() {
foo(NULL); // Ambiguity
// C++ 11
foo(nullptr); // call foo(char*)
}
In c++ NULL value is integer 0, hence leads to an ambiguity when we invoke below function.
void foo(int i) { cout << "foo_int" << endl; }
void foo(char* pc) { cout << "foo_char*" << endl; }
int main() {
foo(NULL); // Ambiguity
// C++ 11
foo(nullptr); // call foo(char*)
}
Comments
Post a Comment