CJCoding With Joseph
15free / daySign inCreate account

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 the output shown in Expected Output.

A new Timer(10) ticked once prints:
11

Expected Output:

2

= newline. The output ends with a newline — print one after the last line.

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