Constructor Chain Trace
hardQuestion 615Constructors 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, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
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.