error C2228: left of '.GetX' must have class/struct/union
<p>Below is Point.h:</p>

<pre><code>class Point
{
public:
    Point();
    Point(int, int);
    void SetX(int);
    void SetY(int);
    int GetX() const;
    int GetY() const;
private:
    int x, y;
};
</code></pre>

<p>In another class "Employee", there is a method whose parameter is a Point object and I want to call its member method GetX() and GetY(), but it failed with error "C2228: left of '.GetX' must have class/struct/union" and "C2228: left of '.GetY' must have class/struct/union", why would this happen?</p>

<p>Employee.h</p>

<pre><code>class Employee
{
public:
    Employee(string str, Point &amp;p)
    {
        name = str;
        point = p;
    }
    void SetCoordinates(Point &amp;p)
    {
        point.SetX(p.GetX()); //**error here**
        point.SetY(p.GetY()); //**error here**
    }
private:
    string name;
    Point point;
};
</code></pre>