Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!daver!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c++ Subject: Re: "foo operator+()" vs "foo& operator+()" Message-ID: <2753DDF4.7359@tct.uucp> Date: 28 Nov 90 15:55:32 GMT References: <11782@hubcap.clemson.edu> <1990Nov22.001208.26092@athena.mit.edu> Organization: Teltronics/TCT, Sarasota, FL Lines: 21 According to Reid Ellis : > foo & foo::operator+=(const foo &f) { ... } > > foo & foo::operator+(const foo &f) > { > static foo sf; > > sf = *this; > return sf += f; > } > >The only way to get "caught" using this is if you hold >the return value in a reference, as in: > > foo &rf = foo1 + foo2; I believe that: foo f = (foo1 + (foo2 + foo3)); is likely to break using the reference-to-static trick.