Exercises in this lecture  previous -- Keyboard shortcut: 'p'        Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 5.5
Friends and 'enemies' of a class with private and public bases

In this program from the accompanying slide arrange that the function void frD(D &ad) becomes a friend of class D. (You can just rename the function f to frD and arrange the friendship).

From frD , please access b, c, d in ad. Also from frD , please also call the member functions Bop, Cop, and Dop on ad.

From an identical non-friend function (let us just call it an enemy) do exactly the same as in FrD.

Do you get the results (and the errors) you expect?

Can you arrange that frD can access/call all of b, c, d, Bop, Cop, and Dop?