When checking my code with PC-LINT it advised me to make some member-functions const
What is the advantage of doing this ?
disc
0
Light Poster
Recommended Answers
Jump to PostI do it just to remind myself (and the compiler) that no class variables can be changed in this function. Basically just to keep me from accidentally doing something stupid!
ie.
double YourClass::GetX() { x_ = 2.0; }
You should not be modifying any of the …
All 4 Replies
daviddoria
334
Posting Virtuoso
Featured Poster
Murtan
317
Practically a Master Poster
siddhant3s
1,429
Practically a Posting Shark
disc
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.