Hello,
I am a newbie and learning C++ by myself from online. I was studying about the keyword Friend and here is the piece of sample code
It said that declaring a non-member function as a friend of class allows it to access the class' private membersCode:class Myclass { public: Myclass() { reg =0; }; private: int reg ; friend void someFunc(Myclass &obj); }
So my question is that what is meant by non-member function Or specifically how somefunc become non-member function. Before reading this, I thought that the member function of a class is a function that has its definition or its prototype within the class definition. So here prototype of someFunc is defined that leads it to be a member function. Right?