class NeedConstructor
{
public:
const int maxCount;
int& ref;
int sample;
};
int main()
{
NeedConstructor cr;
cr.maxCount = 100;
cr.ref = cr.sample;
return 0;
}
class NeedConstructor
{
public:
const int maxCount;
int& ref;
int sample;
NeedConstructor();
};
NeedConstructor::NeedConstructor()
{
maxCount = 100;
num = sample;
}
int main()
{
NeedConstructor cr;
return 0;
}
class NeedConstructor
{
public:
const int maxCount;
int& ref;
int sample;
NeedConstructor();
};
NeedConstructor::NeedConstructor()
: maxCount(100), ref(sample)
{
sample = 200;
}
int main()
{
NeedConstructor cr;
cout << "cr.maxCount = " << cr.maxCount << "\n";
cout << "cr.ref = " << cr.ref << "\n";
return 0;
}