class X{ public: void someFunction (X *x) { this = x; }}
The code above willnot compile since assignment to thethis parameter is not allowed in C++. Thethis parameter can not be modified, because it always refers to the current object. Note that trying to modify thethis keyword would not work in Java either.
Would you like to thankProgrammerInterview.com for being a helpful free resource?Then why not tell a friend about us, orsimply add a link to this page from your webpage using the HTML below.
Link to this page:
Please bookmark with social media, your votes are noticed and appreciated: