声明一个Rectangle类,有长itsWidth、宽itsLength等属性,重载其构造函数Rectanle()和Rectangle(int width,int length)。填空完成下面程序。 #include
class Rectangle {public: (1) ; Rectangle(int width,int length); ~Rectangle(){ } int GetWidth() const{ return itsWidth;} int GetLength() const{ return itsLength;} private: int itsWidth; int itsLength; }; Rectangle::Rectangle() { itsWidth=5; itsLength=10; } Rectangle::Rectangle(int width,int length) {(2); (3) ; } void main() { Rectangle Rect1; cout<<"Rect1 width:"<
<
>aWidth; cout<<"\nEnter a length"; cin>>aLength; Rectangle (4); cout<<"\nRect2 width:"<
<