const before function decleration

      No Comments on const before function decleration
const T& data() const { return data_; }
^^^^^

means it will return a const reference to T (here data_)

Class c;
T& t = c.data()             // Not allowed.
const T& tc = c.data()      // OK.

Leave a Reply

Your email address will not be published. Required fields are marked *