jeudi 22 juillet 2021

Regarding usage of const in this scenario

Header file has this.
std::string m_StrId;

Source file has this.
const std::string& getStringId() const { return  m_StrId; }

I am seeing these two lines of code. What is the purpose of the second const here ?

Aucun commentaire:

Enregistrer un commentaire