← 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= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.