_U_>>Чувака поразил факт, что базовые типы тоже имеют конструктор.
J>меня бы этот факт тоже поразил, потому что они не имеют конструктора.
Привожу текст из английского оригинала своей любимейшой книги по C++:
The C++ Programming Language (Special Edition) Bjarne Stroustrup.
Section 6 Expressions and Statements
6.2.8 Constructors
The construction of a value of type
T from a value
e can be expressed by the functional notation
T(e). For Example:
void f(double d)
{
int i = int(d);
}
The
T(e) construct is sometimes referred to as a
function-style cast. Unfortunately, for a built-in type
T,
T(e) is equivalent to
(T)e.
The
constructor notation T() is used to express the default value of type
T.
void f(double d)
{
int j = int();
}
...
Thus,
int() is another way of writing 0.