Question: C++ URGENT SOLUTION #include using namespace std; class Rectangle { double length,width; public: Rectangle(double l=0.0, double w=0.0) { length=l; width=w; } void display() { cout

C++ URGENT SOLUTION

#include

using namespace std;

class Rectangle

{

double length,width;

public:

Rectangle(double l=0.0, double w=0.0)

{

length=l;

width=w;

}

void display()

{

cout<<"Length="<

}

};

int main()

{

Rectangle R1(2,4);

!R1;

R3.display();//Length=4 Width=2

}

Overload Not(!) operator for the Rectangle class. This operator should swap the values of length and width as shown in the above mentioned code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!