Hi all,
I have a derived a class 'box' from my base class 'rectangle'. My main problem is getting my constructor for box to work. My IDE complains that "No default constructor exists for class "rectangle"".
Code:
class box : public rectangle
{
private:
double height;
public:
box(double height_val)
{
height = height_val;
}
I've tried passing a parameter to my base class 'rectangle' (red highlight):
Code:
class box : public rectangle
{
private:
double height;
public:
box(double height_val) : rectangle(height_val)
After doing that it gives a syntax error with "+2 overloads". My base constructor rectangle looks like this:
Code:
rectangle(double length_val, double width_val)
What am I doing wrong?
Thanks for your help in advance.