How can I make this function act like an l-value?

Posted by BeeBand on Stack Overflow See other posts from Stack Overflow or by BeeBand
Published on 2010-03-21T13:05:48Z Indexed on 2010/03/21 13:11 UTC
Read the original article Hit count: 239

Filed under:
|

Why can't I use the function ColPeekHeight() as an l-value?

class View
{
    public:
        int ColPeekHeight(){ return _colPeekFaceUpHeight; }
        void ColPeekHeight( int i ) { _colPeekFaceUpHeight = i; }
    private:
        int _colPeekFaceUpHeight;
};

...

{
    if( v.ColPeekHeight() > 0.04*_heightTable )
        v.ColPeekHeight()-=peek;
}

The compiler complains at v.ColPeekHeight()-=peek. How can I make ColPeekHeight() an l-value?

© Stack Overflow or respective owner

Related posts about lvalue

Related posts about c++