3 ms·
Easy way to avoid this problem: don't use classes.
Easy way to avoid this problem: don't use classes.
This idea is not limited to OO systems and classes, "private" visibility is very useful in languages that make use of modules as well.
Solve what problem? I'm no fan of classes but I don't know what problem you're talking about specifically.