| 12 | void foo(int); |
| 13 | |
| 14 | int main() { |
| 15 | |
| 16 | if(NULL == (void *)0) |
| 17 | std::cout << "NULL == 0" << std::endl; // 该行将输出 |
| 18 | else |
| 19 | std::cout << "NULL != 0" << std::endl; |
| 20 | |
| 21 | foo(0); // 调用 foo(int) |
| 22 | //foo(NULL); // 该行不能通过编译 |
| 23 | foo(nullptr); // 调用 foo(char*) |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 | void foo(char *ch) { |
| 28 | std::cout << "call foo(char*)" << std::endl; |
| 29 | } |