โ Back to Inheritance
Question 549
Chained this And base Constructors
Chained this And base Constructors
ShapestoresSides. BuildPolygonwith two constructors: a main onePolygon(int sides, string label)that callsbase(sides)and stores the label in a public fieldLabel, and a second onePolygon(int sides)that delegates to the main constructor withthis(sides, "polygon"). Do NOT write aMainmethod. Fornew Polygon(3)the program prints: 3 polygon
Expected Output:
3 polygon
Topics:
Inheritance
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.