Q:

Can you change ‘this pointer’ of an object to point to different objects in c++?

0

Can you change ‘this pointer’ of an object to point to different objects?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

You can not reassign the ‘this’ pointer. This is because this pointer is rvalue when you try to point it to another object compiler gives you a warning and you will get this error “lvalue required as left operand of assignment”. The warning message could be different.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions For Experienced

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Can you modify the ‘this pointer’ type in c++?... >>
<< Can we have a virtual constructor in C++?...