Input
Output
#include <iostream> using namespace std; class Rectangle{ private: int length, breadth; public: Rectangle(); Rectangle(int,int); Rectangle operator+(Rectangle); void show_data(); }; Rectangle:: Rectangle(){ length=0; breadth=0; } Rectangle:: Rectangle(int a, int b){ length=a; breadth=b; } Rectangle Rectangle::operator+(Rectangle r1){ Rectangle t; t.length=length+r1.length; t.breadth=breadth+r1.breadth; return t; } void Rectangle::show_data(){ cout << "Length: " << length << " Breadth: " << breadth << endl; cout << "Area of the Rectangle: " << length * breadth << endl; } int main(){ Rectangle r1(10,20),r2(20,30),r3; r3=r1+r2; r1.show_data(); r2.show_data(); r3.show_data(); return 0; }