Here's the problem:
I have a member function void fetch(int ID);
Inside this function I'm using a O/R mapping tool that fetches an object by id like this:
query = query.find("id").equals(ID);
someObject =(someObject) persistant.GetObjectFromDB(query);
and I'd like to continue by saying
this = someObject;
but I can't because the 'this' reference is read-only. I could do this,
id = someObject.id
description = someObject.description ... and so forth, but this defeats the purpose of using the O/R mapping tool.
Does anyone have a slick solution requiring only a few lines of code?
Please note that changing the return type of fetch is not acceptable. It must not return anything. It only purpose is to fill an instance member with values from the databse.