7 ms·
> the default case is that you want everything public (unless you like writing trivial getters and setters just for the fun of it); legitimate uses of "private"
by MauranKilom 5y ago
> the default case is that you want everything public (unless you like writing trivial getters and setters just for the fun of it); legitimate uses of "private" exist, but are rare
Any time a class has invariants to maintain, you probably need private. That could be infrequent in your experience, but overall, invariants are a cornerstone of abstractions.