TWiki . Dev . FieldTypeOverriding

It is often useful to declare that, in a subclass, a certain field of the superclass has a more precise type. To be safe, this feature only applies to final fields.

class A
  final Reader reader;

class B extends A
  override FileReader reader;

The new type must be a subtype of the original type, and the original field must be final.

Implementation notes: the type in the default constructors of B must be changed. For the field access methods, the get method can simply be overriden.

-- DanielBonniot - 21 Jul 2003

This is implemented in the DevelopmentVersion (future 0.9.1) of the compiler.

-- DanielBonniot - 02 Aug 2003

----- Revision r1.2 - 02 Aug 2003 - 08:24 GMT - DanielBonniot
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.