Loosen Constructor super()/this() call restrictions

Marek Kozieł develop4lasu at gmail.com
Thu Mar 26 13:22:37 PDT 2009


2009/3/24 Howard Lovatt <howard.lovatt at gmail.com>:
> I don't get the example. Is class B meant to be Bar? Can you clarify?
>
> -- Howard.
>

No, B is B.
I wanted show the problem:
public B(Bar bar, Foo foo) {
        super(bar);
        this.foo = foo;
     }
mean in runtime:
        this.bar = bar;
        this.foo = bar.foo;
        this.foo = foo;


public B(Bar bar, Foo foo) {
        this.foo = foo;
        super(bar);
     }
mean in runtime:
        this.foo = foo;
        this.bar = bar;
        this.foo = bar.foo;

While second constructor look really innocent.
-- 
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł

http://lasu2string.blogspot.com/



More information about the coin-dev mailing list