โ Back to Classes
Question 221
Independent Instances
Independent Instances
Using yourCounterclass (a private count,Increment(),GetCount()), the tester creates TWO separate counters to show each object has its own state. Implement the class so two instances are independent. Do NOT write a Main method. The tester increments the first counter twice and the second once, then prints '2 1'.
Expected Output:
2 1
Topics:
Classes
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.