Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Steven Simpson Newsgroups: comp.lang.java.programmer Subject: Re: multiple inheritance in Java Date: Wed, 03 Jul 2013 14:12:22 +0100 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <61a00488-56ab-4452-bb3c-74e79d1a7d81@googlegroups.com> <6h8daa-4g3.ln1@s.simpson148.btinternet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: mx05.eternal-september.org; posting-host="cc132b90ecd364d1ff0d0f79661909d4"; logging-data="8251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19YAEaVGzh61Irvj1XDl1waz9ll7HOYzy8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: Cancel-Lock: sha1:NLUmWq1cPtwS3Y4zdT/QmyBLeuY= Xref: csiph.com comp.lang.java.programmer:24611 On 03/07/13 13:01, lipska the kat wrote: > It is possible to add state to an interface so that it is *almost* a > class [...] > > interface Foo{ > > /* explicitly static and final */ > Integer i = 0; > State state = new State(); /* final reference, mutable instance */ > > default public void doFoo(Integer x){ > //i = 10; /* illegal */ > Integer y = x + i; > state.a = y + y; > System.out.println("doingFoo, i + x is " + y); > System.out.println("doingFoo, accessing state state.a is " + > state.a); > } > } Foo.state is effectively class state, rather than instance state, isn't it? Some possibilities were discussed here: -- ss at comp dot lancs dot ac dot uk