CJCoding With Joseph
15free / daySign inCreate account

Constructor Chain Trace

Constructors run from the top of the hierarchy down. A's constructor prints A constructor. Create B : A whose constructor prints B constructor, and C : B whose constructor prints C constructor. Because base constructors run first, creating a C prints all three lines top-down. Do NOT write a Main method.

When the tester creates a C, the program prints the output shown in Expected Output.

Expected Output:

A constructor
B constructor
C constructor

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

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