You should provide a default constructor for class CRectangle (the one with no arguments), because the line CRectangle rect (2,3), rectb; calls for one. Ideally:
1 2 3 4
CRectangle::CRectangle () {
width = newint; // ideally assign memory to this pointers now
height = newint;
}
Your constructor is enough if you wish to create rectangles like this: CRectangle rect (a, b);
But if you wih to create them like you did with rectb: CRectangle rectb; - you are in fact calling the nonexistant function CRectangle::CRectangle (); So your options are limited to either not creating rectangles without params, or providing another constructor to your class.
You add additional constructors like any other member functions, so first insert function prototype CRectangle::CRectangle (); into class body (make it public!), and then insert implementation (my code in previous post) somewhere outside the class, preferably next to your own constructor.
You can make as many different constructors as you want, as long as they take different parameters.