class Point
{
private:
double x; // a point on the x-y plane
double y;
public:
Point(constdouble a = 0, doubleint b = 0): x(a), y(b){};
// this ctor sets the coordinates (x, y) to the input values (a, b)
};
class Line
{
private:
Point begin; // a line has two ends
Point end;
....
}
I want to have a ctor for Line, which accepts four coordinates, calls the two-parameter ctor of Point, which in turns properly initializes Line::begin and Line::end.