here's my question:
What does the "const" at the end of a function do?
bool CheckAnimation(........) const;
const FrameSkeleton& GetSkeleton() const
{
return ........;
}
Posted 17 November 2012 - 09:33 AM
Posted 17 November 2012 - 10:52 AM
No, I meant what I wrote, but I see now how my statement can be read in two ways that have different meanings. You can call anything on a non-const object, but only const-functions on a const object.That's not right. You probably meant to say something else...
You can only call const-functions on a const object
Posted 17 November 2012 - 11:49 AM
Posted 17 November 2012 - 02:09 PM
Well to be pedantic, there are also volatile functions and objects (and const volatile functions and objects). If an object is non-const, but volatile, you can't call a const-function that isn't also a volatile function on it. And if you've got a const object you can also call a const and volatile function on it. Fortunately, volatile and const volatile functions are very rare in the wild.You can call anything on a non-const object, but only const-functions on a const object.
Posted 19 November 2012 - 04:56 PM