Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-11-13 14:40:14


Darin Adler wrote:

> > To me, friend is a scope !
> >
> > So there are member functions, free functions, and friends.
>
> Thinking of a friend function as a scope might be useful in some contexts. I
> think it could be misleading in others.

Of course friendship also has to do w/ access control.

> Each member function is a member of exactly one class. A friend function can
> be a friend of any number of classes.

But it should only be defined once.

> int vb();
> struct D { friend int vb(); };
> struct A { friend int vb(); };
>
> Given this, I'm not sure why it's good to put a function that has no friends
> in a special category called "free function".

It is

> The way I see it, each non-member function can have 0 or more classes that
> call it friend.

But should only be defined in one class.

-- 
Valentin Bonnard

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk