class Foo
{
public:
const int x;
};
class Bar
{
private:
const int x;
};
आउटपुट:'सार्वजनिक' पहुंच योग्यता और `const`ness। `-Wuninitialized`
test.cpp:10:13: warning: non-static const member ‘const int Bar::x’ in class without a constructor [-Wuninitialized]
क्यों Bar
एक चेतावनी का उत्पादन लेकिन Foo
नहीं करता है (जाहिर है पहुँच क्वालीफायर की वजह से, लेकिन तर्क क्या है?)।
क्या यह पूरा कार्यक्रम है? –
यह पूर्ण एमडब्ल्यूई है जिसे मैंने संकलित किया है। – aiao