Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!brunix!sdm From: sdm@cs.brown.edu (Scott Meyers) Newsgroups: comp.lang.c++ Subject: Re: Friends and Overloading Message-ID: <59833@brunix.UUCP> Date: 18 Dec 90 18:22:50 GMT References: <1655@rose.ACA.MCC.COM> Sender: news@brunix.UUCP Reply-To: sdm@cs.brown.edu (Scott Meyers) Distribution: na Organization: Brown University Department of Computer Science Lines: 33 In article <1655@rose.ACA.MCC.COM> juan@radar.UUCP () writes: | In order to 'copy' each class to the other, I created a friend | function for operator= for each permutation, (varray,varray), | (varray,farray), (farray,varray), and (farray,farray). | | class farray | { | // some stuff | public: | void friend operator=(farray,varray); | // more stuff | } | | void operator=(farray,array) | { | // some code | } You can't write a global operator= function; it must be a member function. See ARM, p. 334. Just out of curiousity, what compiler let you get away with that? cfront 2.0 and 2.1 reject it as anachronistic, although g++ seems to think it's okay... Scott ------------------------------------------------------------------------------- Good news, Providence! Buddy Cianci is under 24-hour police protection due to threats on his life. There may yet be hope for "America's best city."