Back to Multiple Choice Quiz
Static Class Member
C++ quiz · Question 20What is the output of this code?
Code
1#include <iostream>2using namespace std;34class Counter {5public:6 static int count;7 Counter() { count++; }8};910int Counter::count = 0;1112int main() {13 Counter a;14 Counter b;15 Counter c;16 cout << Counter::count << endl;17 return 0;18}