friend function | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

friend function

Why is the friend function declared inside class? Example below: class Person{ friend void Test(); }

21st Mar 2018, 6:33 AM
Đoàn Đức
Đoàn Đức - avatar
1 ответ
0
inorder for the compiler to recognize the friend functions, when it creates an instance of the class. in other words without it being decleard inside the class he wont recognize it.
21st Mar 2018, 4:05 PM
Asher
Asher - avatar