C++ Quiz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++ Quiz

A program with data member a and b initialized to 5 and 7. It should then use a friend function to swap, subtract 2 from each value and display resultant value

29th Jan 2019, 6:36 PM
H4xor
H4xor - avatar
10 Answers
29th Jan 2019, 8:32 PM
Maneren
Maneren - avatar
+ 2
You're welcome
29th Jan 2019, 8:52 PM
Maneren
Maneren - avatar
+ 1
Homework or Challenge?
29th Jan 2019, 6:42 PM
Maneren
Maneren - avatar
+ 1
Am a C# coder and I never use friend classes 😂😅. Found this question somewhere. Wondering how it'll be implemented
29th Jan 2019, 6:44 PM
H4xor
H4xor - avatar
+ 1
Ok. Gonna take a look on it
29th Jan 2019, 6:45 PM
Maneren
Maneren - avatar
+ 1
I don't see the point of using friend function here. Can tell my why?
29th Jan 2019, 6:54 PM
Maneren
Maneren - avatar
+ 1
Umm. Actually I have no idea The question is exactly like that. I didn't understand either
29th Jan 2019, 6:56 PM
H4xor
H4xor - avatar
+ 1
I see now. Then I'll just create an object to subtract one from each. Thanks man 👍
29th Jan 2019, 8:46 PM
H4xor
H4xor - avatar
+ 1
For nothing. I learned a lot about classes now, i was going through tutorial without thinking and now i am like "I learned that, that is impossible".
29th Jan 2019, 8:48 PM
Maneren
Maneren - avatar
+ 1
Uhh, I see. But you've been helpful. I appreciate. I got you next time
29th Jan 2019, 8:49 PM
H4xor
H4xor - avatar