Note, for:
1 2 3 4
|
class obj{
public:
int x, z, y;
};
| |
All these are true:
[*] The constructor is not user-provided (i.e., is implicitly-defined or defaulted on its first declaration)
[*] has no virtual member functions
[*] has no virtual base classes
[*] has no non-static members with default initializers.
[*] has no direct base
[*] Every non-static member of class type (or array thereof) has a trivial default constructor
Hence the (implicitly-defined) constructor is trivial and does no actions.
1 2 3 4 5
|
class obj{
public:
int x, z, y;
obj() = default;
};
| |
Although defaulted, it is still trivial.
1 2 3 4 5
|
class obj{
public:
int x, z, y;
obj() {}
};
| |
Explicit constructor. The x, z, and y are
default initialized, i.e. are initialized to indeterminate values.
In other words, the constructor does no actions.
https://en.cppreference.com/w/cpp/language/default_initialization
In other words, the resize(bigger_number) does not really do anything for/with the added elements.