โ Back to Classes
Question 65
Rectangle Combine Dimensions (operator+)
Rectangle Combine Dimensions (operator+)
You 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
Topics:
ClassesOperator Overloading
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.