Vector3& Center ();
const Vector3& Center () const;
consts and stuff
one is for retrieving, the other for setting:
the retrieval is done via the const version of the function.
at least that''s the way i use ''em.
minZ = bOBB.Center().z - bOBB.Extent(2); // retrieving bBox.Center().x = min.x + dX*0.5f; // setting
the retrieval is done via the const version of the function.
at least that''s the way i use ''em.
If the object being operated-on is a const object, it can only use the second. If the object is non-const, my compiler chooses the first. I don''t believe the compiler can use the return value to determine the function type (IANALL), so I think it just calls the function that corresponds to the type of object.
Example:
Example:
class C{public: C &foo () { return *this; } const C &foo () const { return *this; }};int main (){ C mc; C &rc = mc.foo (); // calls C &foo () const C &crc = mc.foo (); // so does this since mc is non-const return 0;}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement