title: Expression must have pointer to object type
body: <p>I'm writing a matrix program and am currently trying to multiply a point and a matrix. I keep getting an error over my objects(result and P) "Expression must have pointer to object type" in this function:</p>
  
  <pre><code>//Point Class functions
  Point Matrix44::operator*(const Point &amp; P){
      Point result;
      for (int i = 0; i &lt; 4; i++) {
          for (int k = 0; k &lt; 4; k++) {
              result.element[i][k] = 0;
              for (int j = 0; j &lt; 4; j++) {
                  result.element[i][k] = element[i][j] * P.element[j][k] + result.element[i][k];
              }
          }
      }
      return result;
  
  }
  </code></pre>
  
  <p>My two classes are:</p>
  
  <pre><code>    //Matrix class
  class Point;
  
  class Matrix44 {
  private:
      double element[4][4];
  public:
      Matrix44(void);
      Matrix44 transpose(void) const;
      friend istream&amp; operator&gt;&gt;(istream&amp; s, Matrix44&amp; t);
      friend ostream&amp; operator&lt;&lt;(ostream&amp; s, const Matrix44&amp; t);
      Matrix44 operator *(Matrix44 b);
      Point operator*(const Point &amp; P);
  };
  
  
  //Point class
  class Point {
      double element[4];
      friend class Matrix44;
  public:
      Point(void) {
          element[0] = element[1] = element[2] = 0;
          element[3] = 1;
      }
      Point(double x, double y, double z){
          element [0]=x;
          element [1]=y;
          element [2]=z;
          element [3]=1;
      }
  
  };
  </code></pre>