CJCoding With Joseph

Constructor Overloading

The Timer class has a private field seconds. Give it TWO constructors: a parameterless one that starts seconds at 0, and one that takes an int start and uses it. Also add a Tick() method that adds 1 to seconds and a read-only Seconds property. Do NOT write a Main method.

A new Timer() ticked twice prints:
2

A new Timer(10) ticked once prints:
11

Expected Output:

2
Topics:
Encapsulation
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.