Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: calling own methods from constructor Date: Wed, 06 Apr 2011 18:24:29 -0400 Organization: albasani.net Lines: 20 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net kmPbrRACv6FIy64atUoFshrqxJaUwM5qJ2ciurh9drZ9dgcev6ZbcVFQUo+8WWy7V9uekCZUnqQwooO7CgZXIA== NNTP-Posting-Date: Wed, 6 Apr 2011 22:24:27 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="1deQBovAnZlKobxXshQTkMH3onQBC7NG9WeByL99TDJT4zCR1ojI5wNUcUfPlJZSMA2IyNb0ZicqUHHa+ZjNJhA3jzt80QSlSxWlaNEFzVhtPPM1T0hDf1L03yDSFlmD"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: Cancel-Lock: sha1:+l7oma2qfjjj6ELDz1574jRrDpU= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2907 Andreas Leitgeb wrote: >> Is there any *good* use of having the constructor call a method that >> actually *can* be overridden in a subclass? I mean, are there >> (non-anti)patterns of explicitly allowing subclasses to hook into >> base-class's construction? import org.apache.log4j.Logger; import static org.apache.log4j.getLogger; public class Foo { private final Logger logger = getLogger( getClass() ); // ... } -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg