Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 24 Apr 2011 16:42:06 -0500 Date: Sun, 24 Apr 2011 14:42:01 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.java.help Subject: Re: Is it sign of bad Object Oriented programming? References: <87wriklitz.fsf@merciadriluca-station.MERCIADRILUCA> <2IednYrMyuph4inQnZ2dnUVZ_gWdnZ2d@earthlink.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 33 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 75.8.126.96 X-Trace: sv3-BM1lZQqdanrNtYfu5rf2Ya8BYjZkvLZp7V5bBVqG6Ng2lfUJrivJQSNPwOZVq7zpCXQkXYStzLy54Q9!rfI9kSDFa22RGcavMRF6tHb8jYHB4VY5VY8s2Jem+xbCAstcgrrvhqHLYXRZjXC/Db8Nd+yksoEn!Uzh0fTrpPEl+wVj7b1lCF5WUSVSANLOq4xq2R+E8Sb0= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2229 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:644 On 4/24/2011 2:26 PM, Lew wrote: > Patricia Shanahan wrote: ... >> Consider an arithmetic type Widget, like BigInteger, with a multiply >> method that returns the Widget representing the product of this and a >> Widget argument. >> >> Now write Widget's square method: >> >> public Widget square() { >> return multiply(this); >> } >> >> Is that what is being discussed? > > Of course, the OP will have to clarify this, but the example given was: > > myObj.myMeth(myObj) > > This represents a client, not 'this', calling a method that takes the > reference itself as an argument. Stefan Ram gave a motivating example: > > System.out.println( System.out ); > > Your example doesn't fit the proffered pattern. > OK. Suppose Widget does not offer a square method, but I need the square of the Widget referenced by x: Widget xSquared = x.multiply(x); Patricia