How to acces friend function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to acces friend function

how to access friend function for an object created with pointer method Classname *object = new Classname(); becoz object->friendfunction(obj); not working.. 😓

4th Oct 2018, 10:54 AM
Omkar Tripathi
Omkar Tripathi - avatar
8 Answers
+ 3
just one more question do I have to initialize the overloaded function also as a friend function seperately
4th Oct 2018, 4:06 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 3
Ina thanks 😊
4th Oct 2018, 4:27 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 2
A friend function DONT belong to class then you cannot call it like object member notation
4th Oct 2018, 11:13 AM
KrOW
KrOW - avatar
+ 2
Ina but still i need to access friendfunction for the created object so it performs it's operation
4th Oct 2018, 3:27 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 2
4th Oct 2018, 3:57 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 2
Ina thank you that's exactly I wanted
4th Oct 2018, 4:05 PM
Omkar Tripathi
Omkar Tripathi - avatar
+ 1
KrOW then can i access friend function?
4th Oct 2018, 11:17 AM
Omkar Tripathi
Omkar Tripathi - avatar
+ 1
Omkar Tripathi Its the friend function that can access to object like Ina suggested you... Why you dont post a extract of your code for make us understand your problem?
4th Oct 2018, 3:34 PM
KrOW
KrOW - avatar