I keep running across function definitions inside classes that look like this:
//Accessor function
const string getName() const {
return name;
}
My question is: why does the word 'const' appear twice. I know the 'const' at the end of the definition helps protect the original member information, but what does the first 'const' do?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…