const-correctness

Sell me on const correctness

可紊 提交于 2019-11-26 00:33:00
问题 So why exactly is it that it\'s always recommended to use const as often as possible? It seems to me that using const can be more of a pain than a help in C++. But then again, I\'m coming at this from the python perspective: if you don\'t want something to be changed, don\'t change it. So with that said, here are a few questions: It seems like every time I mark something as const, I get an error and have to change some other function somewhere to be const too. Then this causes me to have to