What the purpose of const keyword for function in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What the purpose of const keyword for function in C++?

I do not get the goal of using const keyword for defining const function in class .

29th Jun 2017, 12:10 PM
Johnny Shahin
Johnny Shahin - avatar
1 Answer
+ 2
It prevents you from making any modifications to class variables and calling other functions that are not const
29th Jun 2017, 3:11 PM
aklex
aklex - avatar