Rectangle Combine Dimensions (operator+)
easyQuestion 65You are combining two rectangular boards end-to-end.
Create a class Rectangle with private ints width and height.
Requirements:
1) Constructor Rectangle(int w, int h)
2) Getters getW() const, getH() const
3) Overload operator+ to return a NEW Rectangle whose width is (w1 + w2) and height is (h1 + h2)
Do NOT write a main function.
Expected output
7x5 5x9
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
ClassesOperator Overloading
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.