Review Questions
1: | What's wrong with the following attempts at establishing friends?
|
2: | You've seen how to create mutual class friends. Can you create a more restricted form of friendship in which only some members of class B are friends to class A and some members of A are friends to B? Explain. |
3: | What problems might the following nested class declaration have?
class Ribs { private: class Sauce { int soy; int sugar; public: Sauce(int s1, int s2) : soy(s1), sugar(s2) { } }; ... ... |
Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.