What is the difference between the following 2 two initializations?
class Pod {
public:
int a, b;
};
Pod *p1 = new Pod;
Pod *p2 = new Pod();
What is the difference between the following 2 two initializations?
class Pod {
public:
int a, b;
};
Pod *p1 = new Pod;
Pod *p2 = new Pod();
In the first case the object is left uninitialized, while in the second case the object is guaranteed to be value-initialized, which in this case as the type is POD it means zero-initialized