[英]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.