codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#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() { void fun2(); 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 }
Private
[
?
]
Run code
Submit