Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何将 B 的构造函数声明为 A 的朋友?我试过:
class A { private: A(); public: friend B::B(); }; class B { public: B(); };
替换B::为class;
B::
class
class A { private: A(); public: friend class B; }; class B { public: B(); };