A
anongroupaccount
class CustomType
{
public:
CustomType(){_i = 0;}
CustomType(int i) : _i(i) {}
private:
int _i;
};
class MyClass
{
public:
MyClass() : _member(4){}
private:
CustomType _member;
};
Will _member be ever created before the initialization list in MyClass?
Am I guarantueed that it will only get created that once?
I have run some tests, but I can't tell if my results are
implementation specific, or undefined behaviour. Is this the right way?
{
public:
CustomType(){_i = 0;}
CustomType(int i) : _i(i) {}
private:
int _i;
};
class MyClass
{
public:
MyClass() : _member(4){}
private:
CustomType _member;
};
Will _member be ever created before the initialization list in MyClass?
Am I guarantueed that it will only get created that once?
I have run some tests, but I can't tell if my results are
implementation specific, or undefined behaviour. Is this the right way?