How to provide default argument as this object?

Posted by atch on Stack Overflow See other posts from Stack Overflow or by atch
Published on 2010-04-03T15:55:40Z Indexed on 2010/04/03 16:03 UTC
Read the original article Hit count: 256

Filed under:
|

I would like to have declaration like this:

void Date::get_days_name(const Date& = this)

which I would understand that if no argument is provided use this object as an argument. For some reason in VS I'm getting err msg:

'Error 1 error C2355: 'this' : can only be referenced inside non-static member '

Any idea what I'm doing wrong?

© Stack Overflow or respective owner

Related posts about c++

Related posts about default-value