KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
There is such code: #include <iostream> class A{ public: friend void fun(A a){std::cout << "Im here" << std::endl;} friend void fun2(){ std::cout << "Im here2" << std::endl; } friend void fun3(); }; void fun3(){ std::cout << "Im here3" << std::endl; } int main() { fun(A()); // works ok //fun2(); error: 'fun2' was not declared in this scope //A::fun2(); error: 'fun2' is not a member of 'A' fun3(); // works ok } How to access function fun2()?
Tags (comma-separated)
Save Edits
Cancel