0

Making a function friend

How to make a function friend of a seprate class file ?

5th Dec 2017, 1:12 PM
CoderAss
CoderAss - avatar
1 Resposta
+ 1
Declare the function inside the required class as friend and define it outside of that class (but don't write "friend" keyword in the definition part). For example: class CLASS{ //we are in the class named CLASS ...... public: //access specifier friend the_function();//here it's declared with the //keyword "friend". };//now we are out of the class the_function()//here it will be defined (no "friend" //keyword { ......... //definitions } Hope it helps.
5th Dec 2017, 5:44 PM
1604064_Sharif
1604064_Sharif - avatar