Monday, 9 September 2013

friend functions and declarations

friend functions and declarations

I had class which had a friend function for example if the header was:
class A{
friend void foo();
public:
A(){}
};
void foo();
So what I cannot get is what does the compiler do with the second
declaration?
I've all so noticed I can write as many of them as I want with no effect, e.g
void foo();
void foo();
...
(Assume the implementation is in the cpp file)
Plus I couldn't find where does the standard say the declaring some
function as a friend also declares the function itself.

No comments:

Post a Comment