Question: #include using namespace std; class Rectangle { public: }; int int length; int width; Locate and explain the errors in the following class definitions:
#include using namespace std; class Rectangle { public: }; int int length; int width; Locate and explain the errors in the following class definitions: Rectangle(int len, int wid) { length = len; width = wid;} void area() { } cout < < length*width < < end1; Rectangle operator++(int) { length++; width++; } Rectangle operator--(int) { length--; width--; } main() { Rectangle r(3, 2); r.area(); r++; r.area(); r--; r1.area(); return 0; Act Go to #include using namespace std; class Rectangle { public: int length; int width; Rectangle(int len, int wid) { length = len; width = wid;} void area() { } } cout < < length width < < endl; Rectangle operator++ (int) { length++; width++; } Rectangle operator--(int) { length; width--; } int main() { double a = 3.2, b = 2.5; Rectangle r(a, b); r.area(); r++; r.area(); r--; r.area(); return 0; Rectangle operator--(int) { length++; width++; } class Rectangle { public: double length; int width; Rectangle(int len, int wid) { length = len; width = wid;
Step by Step Solution
3.37 Rating (150 Votes )
There are 3 Steps involved in it
Lets go through each of the provided code snippets and identify the errors include using namespace std class Rectangle public int length int width Rec... View full answer
Get step-by-step solutions from verified subject matter experts
