关于友元函数的优缺点(on advantage and disadvantage of friends' function)

a summary of c++ friends' function
in fact, there are probable the following two situations needs to use the friends' function:
(1)some occasions of operator overloading needs to use friends' function
(2)two classed need to share data
the advantage and disadvantage of using friends' function
advantage: can improve efficiency, simple and clear expres
disadvantage:friends' function break the encapsulation mechanism

posted @ 2017-10-15 12:20  diamondDemand  阅读(625)  评论(0)    收藏  举报