Yesterday I answered a question: Here is my answer
Then me and another SO user argued about the correctness and possible problems that might occur if the question owner uses it. All these argument went on the comments of my answer.
But then, the question owner declares that his question is totally misunderstood, and other user is right (as a comment) and edited my answer for changing it; fixing the misunderstanding and changing my approach with the approach of the other user. Then accept it.
When I check the edit, I see that nearly all code sample block that I wrote had been changed. Only lines of explanation left unchanged. From that perspective, it was not my answer anymore. Also I got reputation from an answer that do not belong to me.
What is the best thing to do at this point?
UPDATE: A point that I do not see right is, when he realizes that we misunderstood the question; instead of updating his question and add more detail and code samples, he chooses to fit my answer to his question.