I'm new to using C++ to write enterprise software at my company and the usage of const in member functions has been quite confusing to me. For example, I have the following method:
string DAC::impulse_find(int i)
There will be no modification of the variable i. My code compiles perfectly when I use these three variants of adding const to the above method:
const string DAC::impulse_find(const int i) const
const string const DAC::impulse_find(const int i) const
string const DAC::impulse_find(const int i) const
So what exactly is the difference between these three? I looked at some past answers and say "It applies to whatever is to the left" but that is still confusing. Does it apply to anything, such as the name of the class as well?