On 26/08/2022 02:59, Manfred wrote:
> - friend by itself should be used parsimoniously: it goes against
> encapsulation, so more often than not it is a symptom of poor design
> (exceptions apply, but they are in fact exceptions)
I also use rarely friends and its the last solution.
But... sometimes it is just easiest and most practical way, if the
classes are tightly linked with each others (like some kind of cache
class for another), and the classes go together "privately".
Also it keeps the code more simple. Instead of writing 20 new lines,
only 1-2 lines of code needed. So its kinda looking for a balance
between "best practices" and practicality/simple-short code.
But again, I only do it if no other easy solution and it has some logic
in it.