โ Back to Inheritance
Question 541
Discounted Product Price
Discounted Product Price
Productstores apriceand has avirtualmethodPricereturning it.SaleProductoverridesPriceto return the base price minus a10discount. Usebase.Price()in your override. Do NOT write aMainmethod. Fornew SaleProduct(50)the program prints: 40
Expected Output:
40
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.