Timeline for Repeated Instantiation of the Same Class in a Method
Current License: CC BY-SA 3.0
2 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 10, 2017 at 10:57 | comment | added | user82096 | Of course if you need the object to be available throughout MyClass, you should make it persist. But surely the question presupposes that it is only needed within one method. You shouldn't give variables a broader scope than necessary just in case they might be needed somewhere else in the future. | |
| Apr 10, 2017 at 8:12 | history | answered | civan | CC BY-SA 3.0 |