Hey,
I've been trying to decide something, its for actionscript (Flash), but still easily relevant to C++.
The purpose of a static function is so you dont have to call the function on each instance of the class; and the function is created once per class, not per instance. But in my situation I have a function that modifies an instance at a time (a normal method), so I dont need the 'call for all instances of' feature. Static variable is per class, and not per object, so of course those would save space, but what about functions?
Basicly, I have two options:
1) I can use a normal method for a certain instance, and I call it, and it simply modifies that instance (itself).
2) I can make the method static, and pass the instance name as a reference, and it modifies the instance.
I would use option 1, but I'm not sure, because option 2 yields the same results - just requires passing a reference of the instance. Since static functions are only created once per class, and normal methods are created for every object - would that mean they would take up more space?. Or does the compiler optimize so a normal method takes up as much space as a static method.
Hopefully someone understands and knows, I'd really appreciate the help. Thanks!