Search ProofOfProgress Blog

Tuesday, January 19, 2016

Remembering how to remember friend class C++

  • Friendships are not symmetric – If class A is a friend of class B, class B is not automatically a friend of class A.
    "I thought you were my friend, but the feelings were not mutual."
  • Friendships are not transitive – If class A is a friend of class B, and class B is a friend of class C, class A is not automatically a friend of class C.
    "Just because he is your friend doesn't make him my friend."
  • Friendships are not inherited – A friend of class Base is not automatically a friend of class Derived and vice versa; equally if Base is a friend of another class, Derived is not automatically a friend and vice versa.
    "You've changed. You are not the person I used to know. I don't like you anymore."

    More: https://en.wikipedia.org/wiki/Friend_class

No comments:

Post a Comment