Possession of custom classes

Hey I'm having a bother figuring out what I'm doing wrong here.. it seem so simple. Check it out:

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
38
39
class Point
{
private:
  int x, y;
public:
  Point(int X, int Y)
  {
    x = X;
    y = Y;
  }  
};

class Square
{
private:
  Point vertexes[4];
public:
  Square(Point a, Point b, Point c, Point d) 
      //ERROR:
      //no matching function for call to ‘Point::Point()'
  {
    vertexes[0] = a;
    vertexes[1] = b;
    vertexes[2] = c;
    vertexes[3] = d;
  }
};

int main()
{
  Point z(0, 0);
  Point y(0, 30);
  Point x(30, 0);
  Point w(30, 30);

  Square(z, y, x, w);

  return 0;
}


The error is at line 19 if you missed it.

Any ideas?? Thanks.
You have not declared the default constructor. Hence the error
Just add a default constructor in Point class
1
2
3

public:
Point() { }; 


You'll be good to go. :)
oh haha so simple thanks :D
Topic archived. No new replies allowed.