Can any one explain | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Can any one explain

What is the problem in this program https://code.sololearn.com/ci8lyVidN3lh/?ref=app

30th Aug 2019, 6:08 PM
👀 Sandy👀
👀  Sandy👀 - avatar
2 Answers
+ 6
The friend function has to be a free function, you have to define it outside. So you have to erase that B:: and it works. void fun(A a,B b) { a.s=10; cout<<"the s value is "<<a.s; }
30th Aug 2019, 6:40 PM
HonFu
HonFu - avatar
30th Aug 2019, 6:52 PM
Paolo De Nictolis
Paolo De Nictolis - avatar