Re: "call to super must be first statement in constructor"
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 01/30/05
- Next message: Roland: "Re: "call to super must be first statement in constructor""
- Previous message: Heiner Kücker: "Re: "call to super must be first statement in constructor""
- In reply to: Paul Chapman: ""call to super must be first statement in constructor""
- Next in thread: Paul Chapman: "Re: "call to super must be first statement in constructor""
- Reply: Paul Chapman: "Re: "call to super must be first statement in constructor""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Jan 2005 08:33:27 -0600
"Paul Chapman" <paul@igblan.free-online.co.uk> wrote in message
news:41fcc781$0$14580$ed2619ec@ptn-nntp-reader01.plus.net...
> Here is an example code fragment:
>
> abstract class Outer
> {
> protected abstract int getValue();
> protected final int value;
> Outer() {
> value = getValue(); }
> }
>
> class Subclass extends Outer
> {
> protected int getValue() {
> return valueProvider.getValue(); }
> private final SomeClass valueProvider;
> Subclass(SomeClass aValueProvider) {
> valueProvider = aValueProvider;
> super(); }
> }
>
Are you aware that virtual method calls from a constructur can have quite
unexpected results? Browse through this thread for a discussion of the
consequences:
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7c7a28aa864e41ec/c068254adb84aef2
- Next message: Roland: "Re: "call to super must be first statement in constructor""
- Previous message: Heiner Kücker: "Re: "call to super must be first statement in constructor""
- In reply to: Paul Chapman: ""call to super must be first statement in constructor""
- Next in thread: Paul Chapman: "Re: "call to super must be first statement in constructor""
- Reply: Paul Chapman: "Re: "call to super must be first statement in constructor""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|