posted 15 years ago
I have a little rule of thumb about static methods:
Does the method take or use any information from the state of an object of its class?Does the method insert or alter any information into the state of an object of its class?If you can confidently answer NO to both those questions, then you can make the method static.Taking information from, or putting information into, anything passed as a parameter doesn't count. But passing a parameter of the same class probably constitutes cheating.
I suggest you follow EFH's suggestion.
Did I write a file-writing static method for you yesterday? Have a look at that; notice that static method takes information about the file, and what to write, as parameters. So it doesn't require any information from the state of an object of its class, nor does it alter anything about the state of any object of its class.