Q
What is the main advantage of nullptr (C++11) over NULL?
-
A
It frees memory automatically
-
B
It can be dereferenced safely
-
C
It is faster
-
D
It has its own type (std::nullptr_t) and is never mistaken for an integer during overload resolution
Correct Answer:
D. It has its own type (std::nullptr_t) and is never mistaken for an integer during overload resolution
Explanation:
NULL is often defined as 0, so f(NULL) may call f(int) instead of f(char*).