C++ const Correctness

In C++, Programming by timfanelliLeave a Comment

Here’s a very thorough article that supplements my recent const rant very nicely. I received a number of emails back arguing against my point that const is important and influential. While I realize that many developers maintain that const-correctness is a waste of time, I maintain that those people are unskilled and lazy ;).

Developing classes that are not const-correct severely limits its usage in well thought out applications, if for no other reason than that a constant instance of your class is unusable! You can’t call non-const methods on const instances, nor can const-methods access non-const (or non-mutable) members. It’s just plain lunacy to not keep const in mind when developing a solid object oriented system.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.