I am looking for an article or documentation that explains why a free static function is better than a private member function, when the given function does not modify or read the private members of the class. To my point of view the advantages are :
Less dependencies
Better encapsulation (for "mammoth" classes, it helps to know that at least those function calls do not modify the members)
I am certain someone has already written something better than what I can do.
Free static functions are passe. One would use a function in the anonymous namespace instead.
They are slightly more maintainable -- since they can't access private members, they are robust against changes to implementation details. A static member function could also be independent of implementation details, but you don't have the compiler verifying that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With