Lecture overview -- Keyboard shortcut: 'u'  Previous page: Friends - Example 1 -- Keyboard shortcut: 'p'  Next page: Friends - class Point - notational convenience -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 30 : 36

Friends - Example 2

Given two classes A and B with private state a and b respectively

We illustrate various possibilities and challenges of providing friendship from one class to the other

friends-sit2.cc
Class A provides friendship to class B.
friends-sit4.cc
Class A and B are mutual friends of each other - problems in this version.
friends-sit3.cc
Class A and B are mutual friends of each other - this version is OK.
friends-sit5.cc
A variant were we want ma to be a friend of B and mb to be friend of A - problems in this version.