Operator Overloading issue

Im trying to finish my code down below, it's getting errors.. please help :(
#include <iostream>
using namespace std;


class Rectangle
{
int length, width;
public:
Rectangle(int l, int w);
void operator!(void) const;
Rectangle& operator+=(const Rectangle&);
friend Rectangle operator<<(ostream&, const Rectangle&);


};

Rectangle::Rectangle(int l, int w)
{
length = l;
width = w;
}

void Rectangle::operator!(void) const
{
cout << length*width<<endl;
}

Rectangle operator<<(ostream& s, const Rectangle& a)
{
s << "Rectangle: length="<<a.length<<" width="<<a.width;
}

Rectangle& Rectangle::operator+=(const Rectangle& r)
{
*this += r.length;
return *this;
}

int main()
{
Rectangle R(6,4);
cout << R << " has area " << !R << endl;
R += 5;
cout << R << " has area " << !R << endl;
}
what are the errors?
What exactly do you want to do with addition operator overloading, increasing the length of rectangle?
Topic archived. No new replies allowed.