#1: The item being returned from the function is const.
#2: The function itself is const, meaning it does not modify the calling object. IE: it can safely be called with a const object.
int data;
class Example
{
public:
int& foo() const { return data; }
constint& bar() { return data; }
};
int main()
{
Example nc; // a non-const object
const Example cc; // a const object
// Example of #1:
nc.foo() = 5; // OK, return value is non-const, so we can assign it.
nc.bar() = 5; // ERROR, return value is const, so we can't assign it.
// Example of #2:
nc.foo(); // OK
nc.bar(); // OK
cc.foo(); // OK, object is const, but function is also const
cc.bar(); // ERROR, object is const, so cannot call a non-const function
}