От: | _Winnie | C++.freerun | |
Дата: | 27.07.05 23:45 | ||
Оценка: |
class A
{
public:
std::string s;
int i;
};
int main()
{
A *pa = new A();
printf("%d", pa->i);
}
5.3.4/15
— If the new-initializer is of the form (), the item is value-initialized (8.5);
8.5/5
To value-initialize an object of type T means:
....
(наш случай)
— if T is a non-union class type without a user-declared constructor, then every non-static data member
and base-class component of T is value-initialized;
....
— otherwise, the object is zero-initialized