CJCoding With Joseph
15per day
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
C++ Quiz #20

Static Class Member

hardClasses

What is the output of this code?

📄 Code

1#include <iostream>
2using namespace std;
3 
4class Counter {
5public:
6 static int count;
7 Counter() { count++; }
8};
9 
10int Counter::count = 0;
11 
12int main() {
13 Counter a;
14 Counter b;
15 Counter c;
16 cout << Counter::count << endl;
17 return 0;
18}