Hello,
I have a class I want to create constructors for. However, as I have structure as part of the class I am running into difficultly since I overloaded the constructor.HTML Code:g++ (GCC) 4.6.0
I have my default constructor with a initializer list and I have a default constructor for the structure in the class.
However, when I added my overloaded constructor I keep getting the following errors, not sure why:
Code:error: Floor_plan::Floor_plan()’ cannot be overloaded error: with ‘Floor_plan::Floor_plan()’Many thanks for any suggestions,Code:class Floor_plan { private: unsigned int width; unsigned int height; struct floor_size { unsigned int x; unsigned int y; // Constructor floor_size() {} floor_size(unsigned int _x, unsigned int _y) : x(_x), y(_y) {} } floor; public: Floor_plan() {} Floor_plan() : width(1), height(2), floor(10, 20) {} Floor_plan(unsigned int _width, unsigned int _height, unsigned int _x, unsigned int _y); ~Floor_plan() {}; unsigned int get_floor_width(); unsigned int get_floor_height(); unsigned int get_floor_x_coordinate(); unsigned int get_floor_y_coordinate(); void set_floor_width(unsigned int _width); void set_floor_height(unsigned int height); void print_floorplan(); };




Reply With Quote