I need help with this c++ question.?

Home » Programming & Design » I need help with this c++ question.?
Programming & Design No Comments

Square has a public overloaded constructor that has one (1) double parameter. It calls the overloaded constructor of Equilateral with 4 and the double paramter as arguments.
Square has a public member function, double get() const, that calls the accesstor function of length from Equilateral. Help needed please.

Best Answer:

Jasi: class Equilateral{
public:
Equilateral(unsigned sides, double length)
{
}
};

class Square:
public Equilateral
{
public:
Square(double length): Equilateral(4, length)
{
}
};

Other answer:

Jasi:
That wasn't really a question.

But setting it up that way makes sense to me. I assume that the parameter for the Square constructor is size. Equilateral would probably have the number of sides and the size as parameters. Squares, of course, have 4 sides, so that's why you're passing in a 4.

benescu:
Yes
Batman:
what is the question?

LEAVE A COMMENT