Announcements
Hello!
There is a class with few fields: List(types::record), PurchId, Amount, Status. I want to override tostring() method so that it returns current state of the class object, for example:
while(listEnumerator.movenext()) { recIdStr = listEnumerator.current().RecId; } return strfmt("%1; %2; %3; %4", PurchId, Amount, Status, recIdStr);
I'm gonna use this method in my unit test cases:
this.assertEquals("expected state", myClass.toString());
Tell me please, what are the troubles that may be committed by this solution?
I didnt face troubles. I saw similar code in C# projects. But i will probably make own method.
I don't see any troubles, but did you face some? Or why are you asking?
On the other hand, I don't understand why you want to override the toString() method for this - can't you just add your own method?
André Arnaud de Cal...
294,099
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator