commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <>
Subject Re: [Math] Issue 348
Date Sat, 06 Mar 2010 00:16:00 GMT
> > Can you imagine a not contrived example? I.e. why would one inherit from a
> >  class while throwing away the implementation?
> It's precisely to keep the implementation that the parent needs to use
> the getter.
> If the parent does not use the getter, then the sub-class will have to
> re-implement the parts of the parent code that don't use the
> (overloaded) getter.

By "implementation" I meant the instance variable in the base class. If the
getter returns another value, then this base class instance variable has
become useless, obviously.
But I'm not sure that we talk about the same thing...

I mean the following situation:
public class A {
  private double a;

  public double getA() {
    return a;
Then you might want to override the getter while still relying on the base
implementation (i.e. calling the base class getter so that both getters
actually refer to the same variable):
public class SubA extends A {
  private Logger log = Logger.getLogger(SubA.class);
  public double getA() {
    return super.getA();
But I don't understand this:
public class AnotherSubA extends A {
  private double subA;

  public double getA() {
    return subA;
This looks more like hijacking rather than extending the base class... ;-)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message