Friends

作者: HenryTien | 来源:发表于2017-04-05 08:24 被阅读6次

Q: What is a friend?

Q: Do friends violate encapsulation?

Q: What are some advantages/disadvantages of using friend functions?

Q: Should my class declare a member function or a friend function?

Q: How can I provide printing for my class Fred?

Q: But shouldn't I always use a printOn() method rather than a friend function?

Q: How can I provide input for my class Fred?

Q: How can I provide printing for an entire hierarchy of classes?

相关文章

网友评论

      本文标题:Friends

      本文链接:https://www.haomeiwen.com/subject/whycottx.html