Friendship, protected, setters...

When it comes to having access to private data, is one method considered better than other?

When it comes to having access to private data, is one method considered better than other?

As with every such decision, the best design is circumstantial. If you have a particular situation in mind, consider sharing it.

friend allows an interface to be implemented by external classes or functions without widening that interface. Friends are part of the implementation and must be reviewed when it changes.

I don't understand how the protected access specifier is related to the problem.

Setters are part of the interface. Discussed here:
http://www.cplusplus.com/forum/general/241225/
Topic archived. No new replies allowed.