There's something weird happening in my code these days. Each time I have to built a new member function, or each time I come back to a previously defined member function, I think:
"hey, this is gonna be the exact same process no matter which instance of this class is calling it, so let's make it static!"
and I also feel like it'll be less memory-consuming since each instance won't have to "carry" one implementation of the function, is that correct?
So instead of having things like:
class Foo
{
int _attributes;
double methods(int parameters)
{
// do stuff using..
_attributes;
};
};
I end up with things like:
class Foo
{
int _attributes;
static double methods(int parameters, Foo* instance)
{
// do stuff using..
instance->_attributes;
};
};
And I can't see any function that wouldn't be transformed this way anymore. All my functions are turning to static and I feel like there's something wrong somewhere..
What am I missing? What is the use of having non-static methods, again? XD