The class implements a public function that evaluates some value. During the calculation, the function creates temporary data, which I also want to get.
I could either add a member of the class that stores this data, which I can get after the function completes, or give the function another parameter so that the caller needs to take care of this. So this is basically
class A { TempData member; ... public Output function(Input input) {
vs.
class B { ... public Output function(Input input, TempData fillme) {
My problem: both versions do not look right. The temp data doesnโt really belong to class A and functions with an extra parameter in class B, I donโt know ...
Is there any other solution? If not, which of the two will you choose and why?
source share