C++ has a mechanism to handle this called "const correctness". Basically if you have a function declared as:
void saveToDatabase(std::string & data);
That data string can be modified. If the declaration is:
void saveToDatabase(const std::string & data);
Then the data string can't (there are ways around this of course) be modified. A set of code is called 'const correct' when all parameters have const on them (or are passed by value, ex: void saveToDatabase(int value, const std::string & data

except those that are modified. So anytime you see saveToDatabase(std::string & data) you're notified that data will be modified by the function in some way.
If a reference to a class is passed in by const reference, then only functions marked as const can be called on it. And if a function is marked as const, then member variables inside those functions can't be modified. (There's ways around this too).
All the code I write is const correct, and I get uppity when others' code isn't.