+ 1

The concept of friend function is like a loophole in C++,then what is the purpose of using it??

16th Apr 2017, 7:56 AM
Rajdeep Chowdhury
Rajdeep Chowdhury - avatar
2 Réponses
+ 9
Hi Rajdeep! A friend function is an option (loophole) that allows access to private and protected members of a class. Say you needed to access private or protected members from 2 different classes...
16th Apr 2017, 11:26 AM
AtK
0
Hello ATK,what you said is absolutely correct but that also means I secured my members and yet again accessed those private or protected members,this is why I find it very confusing.
16th Apr 2017, 11:33 AM
Rajdeep Chowdhury
Rajdeep Chowdhury - avatar