#include <iostream>
using namespace std;
class Apple
{
public:
int i;
string s = "HelloWorld";
string s1;
bool b;
};
int main(int argc, char *argv[]) {
Apple a; //doesn't this trigger default initialization??
cout << a.i << a.s << a.s1 << a.b;
}
如果对象是局部变量,则数据成员将被默认初始化。但这里是输出:0HelloWorld0
. 这不是值初始化吗??