title: Point and Line class in c++?
body: <p>I'm learning C++ (and programming in general) and I'm trying to make both a Point class and a Line class.</p>
  
  <p>A line should be composed of 2 point objects.</p>
  
  <p>Can the C++ gurus look over my work and tell me if this is how you should appropriately use pointers, references and classes?</p>
  
  <pre><code>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 &amp;p1, Point &amp;p2) : p1(p1), p2(p2) {}
  
          void setPoints(Point &amp;p1, Point &amp;p2)
          {
              this-&gt;p1 = p1;
              this-&gt;p2 = p2;
          }
  }
  </code></pre>