//Rectangle.h #ifndef RECTANGLE_H #define RECTANGLE_H class Rectangle { private: double width; double length; public: //constructor Rectangle():Rectangle(0, 0){} Rectangle(double w):Rectangle(w, 2*w){} Rectangle(double w, double l):width(w), length(l){} //accessor double getWidth() const {return width;} double getLength() const {return length;} double getArea() const {return width*length;} //mutator void setWidth(double w) {width = w;} void setLength(double l) {length = l;} }; #endif //main.cpp #include <iostream> #include "Rectangle.h" int main(int argc, char *argv[]) { Rectangle r(10); std::cout<<r.getArea()<<std::endl; return 0; }