class Object
{
public:
void setObject( const float w, const float h );
private:
float width, height;
};
void Object::setObject( const float w, const float h )
{
width = w;
height = h;
// from now on, what should i use? w/h or width/height?
// is one or the other accessed faster?
}
should i use method parameters or class members?
Hello, gamedev!
So, I have this class...
thank you.
The parameters might be faster, because they are allocated on the stack. The instance variables must be accessed indirectly via the this pointer, although depending on the computer architecture, it may not matter at all.
Quote:
// is one or the other accessed faster?
It really really really doesn't matter. Really.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement