Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
friend function
//g++ 5.4.0 #include <iostream> using namespace std; //before declaration of ONE. class ONE; class TWO { public: void print(ONE &x); }; class ONE { int a, b; friend void TWO::print(ONE &x); public: ONE() : a(1), b(2) { } }; void TWO::print(ONE &x) { cout << "a is " << x.a << endl; cout << "b is " << x.b << endl; } int main() { ONE xobj; TWO yobj; yobj.print(xobj); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
C++
Teatime Snack
.
Funny Saying
infix to postfix v 5.0 (with exponent support)
Continuous Sub Set with given sum
PrintShape
LRU - Main
Kolokwium_2011_z7
Dynamic Programming For Combinatorics - 1
Please log in to post a comment.