C++: Friends are welcome but choose them judiciously.
C++ friends can see your internals.
But characterizing the scope of friendship is not always easy. Most new developers fall foul of friendship not being inherited but we can use the parent as a proxy and allow access via a protected parental control :-)
One of the main complaints is friendship breaks encapsulation. This is not true; friendship increases encapsulation by tightly coupling the friend and making it part of the public interface.
Written by LokiAstari
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Oo
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#