I'm learning C++ (and programming in general) and I'm trying to make both a Point class and a Line class.
A line should be composed of 2 point objects.
Can the C++ gurus look over my work and tell me if this is how you should appropriately use pointers, references and classes?
class Point
{
private:
int x, y;
public:
Point() : x(0), y(0) {}
Point(int x, int y) : x(x), y(y) {}
}
class Line
{
private:
Point *p1;
Point *p2;
public:
Line(Point &p1, Point &p2) : p1(p1), p2(p2) {}
void setPoints(Point &p1, Point &p2)
{
this->p1 = p1;
this->p2 = p2;
}
}