← Back to Classes
Question 44
Display Product
Display Product
Create a class Product with private fields name (string) and price (double). Add display() that returns: "name: price".
Do NOT write a main function.Expected Output:
Notebook: 2.5= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.