Just a question, in terms of class design is it wr...
# random
l
Just a question, in terms of class design is it wrong to pass down member variables to private class methods instead of using the member directly in the method?
Copy code
private void foo(Object obj){
obj.doSomething();
}
vs
private void foo(){
mObj.doSomething();
}
I am just looking for some thoughts.
k
Try to think about it in terms of state, ie. does
obj
belong to the state of
MyClass
? If so it should be a member variable, otherwise pass it as an argument to the method.