Friend Class In C++
问题 here im not understanding the concept very well or i am right.... So lets take this "friend" class example here: class MyClass{ friend class AnotherClass; private: int secret; } class AnotherClass{ public: void getSecret(MyClass mc){ return mc.secret; } } So Yes... in the above code it will actually work if you do it... but in general, why cant you use getters and setters all the time instead of friend class? Is the reason of friend class usage because of "tediousness"? 回答1: friend is for