Why can't I use a member initialization list here?
<p>I just finished creating a "Point" class and was working on a "Line" class that has two Point objects (Point startpoint and Point endpoint) as data members. I created a constructor in my Line class that accepts two Point objects as arguments and had originally created it as follows:</p>

<pre><code>Line(const Point&amp; p1, const Point&amp; p2)
{
    startpoint = p1;
    endpoint = p2;
}
</code></pre>

<p>Everything was fine, but then I decided I would use a member initialization list instead of assigning the members to p1 and p2 in the body, just because... But when I changed it to:</p>

<pre><code>Line(const Point&amp; p1, const Point&amp; p2): startpoint(p1), endpoint(p2)
{
}
</code></pre>

<p>I get an error saying "no instance of constructor "Point::Point" matches the argument list" and didn't understand what this meant exactly.</p>

<p>Why doesn't the member initialization list work here?</p>

<p>Thanks.</p>

<p>edit: Sorry, I didn't know if the details of my point class was relevant or not:</p>

<p>// Point.h</p>

<pre><code>class Point
{
private:
    double x;
    double y;

public:
    Point();
    Point(Point&amp; p);
    Point(double x1, double y1);
    ~Point();

    double X() const;
    double Y() const;

    void X(double newx);
    void Y(double newy);
    };
</code></pre>

<p>// Point.cpp</p>

<pre><code>#include "Point.h"

Point::Point(): x(0), y(0)
{
}

Point::Point(Point&amp; p)
{
    x = p.x;
    y = p.y;
}

Point::Point(double x1, double y1): x(x1), y(y1)
{
}

Point::~Point()
{
}

double Point::X() const
{
    return x;
}

double Point::Y() const
{
    return y;
}

void Point::X(double newx)
{
    x = newx;
}

void Point::Y(double newy)
{
    y = newy;
}
</code></pre>
