Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!sdrvx2.sinet.slb.com!saito
From: saito@sdrvx2.sinet.slb.com (Naoki Saito (GEO-002) Ext. 5471)
Newsgroups: gnu.g++
Subject: Friend or public member?
Message-ID: <8909271436.AA14881@ascsu1.SLCS.SLB.COM>
Date: 27 Sep 89 14:36:14 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 19


	Hello, folks!  I sometimes wonder whether I should use friend function
or public member to implement some function.  Suppose I defined a vector
class.  If I want to retrieve the size or dimension of the declared vector,
which one should I use?  The following segments explains the situation:

vector a(100);

int naf = dim(a);	// friend function version.
int nap = a.dim();	// public member function version.

This is only the matter of the implementor's taste?  Should I implement both
ways?  If there's any reason to prefer one of them to the other, please let me
know. 

Thanks in advance,

Naoki Saito (saito@sdr.slb.com)
Schlumberger-Doll Research