3 ms·
If someone really wants to touch a private field, there's more than one way to do that. So "private" merely serves as a safeguard against honest mistakes. In th
by huhtenberg 13y ago
If someone really wants to touch a private field, there's more than one way to do that. So "private" merely serves as a safeguard against honest mistakes. In this capacity it is a close sibling of that "if (0 == x)" contraption. It essentially says that I don't trust myself or others to not make dumb mistakes, so here's a safeguard for that. Not that it's a bad thing to have, but I can easily see that it can be deemed redundant to just having strong coding ethics.
- eropple 13y ago"Coding ethics" stop buffer overflows too, right? ;-)
- huhtenberg 13y agoIt's "discipline", not "ethics". I just had a brain spasm. And, yes, it surely stops them better than some flimsy member access restrictions.
- eropple 13y agoAs opposed to a private array and a public iterator API?
- huhtenberg 13y agoNaughty hands will find a way to break a container/iterator metaphor just the same as a simple buffer. Point being is that it's much better to work with competent developers than to needing to rely an idiot-proof coding style.