[英]Zero initialization of non-POD
为什么在下面的非 POD 类中 x 被初始化为零?
class test {
public:
void print() {
cout << x << endl;
}
private:
int x;
};
int main(int argc, char** argv)
{
test * tst = new test();
tst->print();
cout << is_pod<test>::value << endl;
}
tst->print() 和 is_pod() 都返回 0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.