Introduction to OOP | Chapter 23: Object Interconnections : | next | previous | audio | real | text |
class Complex { public: Complex(double, double); friend double abs(Complex&); private: double rp; double ip; }; double abs(Complex& x) { return sqrt(x.rp * x.rp + x.ip * x.ip); }Friendship is something that is given away, not something that is taken.