Static member functions more efficient?
Hi guys, I'd really appreciate any help on some implementation details I'm not clear on.
I've been trying to get my head around how c++ class objects exist at runtime but I've not had much luck in pinning it down. The way I think it works is that a class object is like a lookup table with addresses of member functions and variables in it, or at least the object is a reference to that table.
One thing is I'm not sure on is if the table (if that's even the right thing to call it) is optimised at compile-time so some member functions - like the ones that don't access member variables - are just treated like standard functions and the finished program doesn't even know they are part of the class (so its object table is smaller). Does that happen? Can it?
So I stumbled on static member functions. I used to think they were only for manipulating static member variables, but now I'm not sure. Are they just standard functions that are effectively 'wrapped' in the class in source code only (making the class equivalent to a namespace for them).
Basically the question is (if you can't be bothered answering any of the others): should all my class functions that don't access member variables be declared static?