Mail Archives: djgpp/1998/12/24/13:55:13
"Steven S. Falls" wrote:
>
> Is their a way to make a global function acsess the private members
> of a class directly? In other words can you make global functions
> friends of classes?
Sure, it's routinely done with iostream inserters and extractors, for
instance (since the first argument to them must be an iostream
reference:
class Vector
{
...
friend ostream &operator <<(ostream &os, const Vector &v);
friend istream &operator >>(istream &is, Vector &v);
};
ostream &operator <<(ostream &os, const Vector &v) { ... }
istream &operator >>(istream &is, Vector &v); { ... }
--
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900
Alcyone Systems / irc maxxon (efnet) / finger max AT finger DOT alcyone DOT com
San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
\
/ Love is the wisdom of the fool and the folly of the wise.
/ Samuel Johnson
- Raw text -