My Function chain doesn't want to work, why?
<p>I have the following class:</p>

<p><strong>GLRectangle.h</strong></p>

<pre><code>#include "XPView.h"

class GLRectangle
{
public:
    int top, left, bottom, right;

public:
    GLRectangle(void);
    ~GLRectangle(void);
    GLRectangle* centerRect(int rectWidth, int rectHeight, int boundWidth=0, int boundHeight=0);
};
</code></pre>

<p><strong>GLRectangle.cpp</strong></p>

<pre><code>#include "GLRectangle.h"

GLRectangle::GLRectangle(void)
{
}

GLRectangle::~GLRectangle(void)
{
}

GLRectangle* GLRectangle::centerRect(int rectWidth, int rectHeight, int boundWidth, int boundHeight)
{
    if(boundWidth == 0)
    {
        boundWidth = XPView::getWindowWidth();
    }

    if(boundHeight == 0)
    {
        boundHeight = XPView::getWindowHeight();
    }

    // Set rectangle attributes
    left   = boundWidth / 2 - rectWidth / 2;
    top    = boundHeight / 2 + rectHeight / 2;
    right  = boundWidth / 2 + rectWidth / 2;
    bottom = boundHeight / 2- rectHeight / 2;

    return this;
}
</code></pre>

<p>and I'm trying to chain a function onto the construction of the object as follows:</p>

<pre><code>wndRect = new GLRectangle()-&gt;centerRect(400, 160);
</code></pre>

<p>but getting the following error:</p>

<pre><code>error C2143: syntax error:missing ';' before '-&gt;'
</code></pre>

<p>Is there a way to get this to work?</p>
