Error in constructor (inheritance)

I am getting an error when I try to do the Square::Square constructor call.

error: expected constructor, destructor, or type conversion before '(' token
Square::Square(s1, s2, s3, s4)

I have put (what I think) are the relevant parts of my code to this problem.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Square : public Shape 
{
    Point bLeft, tLeft, tRight, bRight;
    double side1, side2, side3, side4;
        
	public:
	
	Square();
	Square(double &s1, double &s2, double &s3, double &s4) : side1(s1), side2(s2), side3(s3), side4(s4)
	{}

	
	double getArea();
	double getPer();
	void display();
	//void boundBox();
};

Square::Square(s1, s2, s3, s4)
{
        bLeft(0,0);
        tLeft(bLeft.getX(), bLeft.getY() + side1);
        tRight(tLeft.getX() + side2, tLeft.getY());
        bRight(tRight.getX(), tRight.getY() - side3);
}

int main()
{
	//****sides for square
        double side_s1 = 25;
	double side_s2 = 25;
	double side_s3 = 25;
	double side_s4 = 25;
	
	Square call_s(side_s1, side_s2, side_s3, side_s4);
	call_s.display();


What am I doing wrong?
Read: http://www.cplusplus.com/doc/tutorial/classes/

On your line 8 you do declare a member function.

On lines 9-10 you both declare and implement a member function.

Line 19 does not contain any typenames (apart from the Square). Besides, if lines 19-25 implement the same thing as the lines 9-10, then you have it twice.



PS.
Why does your square has four sides? You are begging for the user to do:
Square fubar( 5, 7, 0.42, 3.14 );
A "square"?

What is the size and position of a default Square?
I thought line 8 was my default constructor for Square?

9-10 is how I have been doing my program all the way through, and how I have seen with many examples of inheritance... Is this not how to do it?

Four sides because I was given advice from someone that I should account for a rectangle... and I need to implement 4 point vertices, so that is the only way I could really think of how to do that. (I do have error checking that if side_s1 != side_s3 || side_s2 !=side_s4 exit) (while writing this I guess I could have had 2 sides, and implemented it that way).

Default square begins at Origin (0,0) (bLeft = bottom left). The instructions are to have sides of 25, so the points will all be

0, 0
25, 0
25, 25
0, 25
This has been figured out.

Thanks for the help and advice!
Topic archived. No new replies allowed.