Questions about const

Hi all,

I have some questions about functions.
In a code I have (a .hpp file) there is this line which says:

const Class_1_Name* Class_2_Name::MethodName(int ipart) const {return (ClassName*)_ref_to_method.At(ipart);}

My questions are:

  • What is the meaning of the two constants, especially the second one? What do they do exactly? (general meaning of course)
  • Why do we use a reference to the method and not the method itself [as in: _ref_to_method.At(ipart)]

Thank you in advance,

~eager

The second 'const' means that this member is not allowed to modify any values inside the class Class_2_name.

I am unable to divine the meaning of your second question. I do not recognize the _ref_to_method macro/operator/extension and don't understand what it's supposed to do... A reference to a method is pretty useless without a reference to its object in any case.

Thank you for the answer and apology for not replying back sooner.

by ref_2_method, I mean a reference to the method mentioned by MethodName. I will try to see if it is possible to show part of this code.

Thank you so much again,

~eager