Nice TWiki > Dev > FeatureProposals > FieldTypeOverriding (r1.1) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Dev . { Changes | Index | Search | Go }
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

Topic FieldTypeOverriding . { Edit | Attach | Ref-By | Printable | Diffs | r1.2 | > | r1.1 | More }
Revision r1.1 - 21 Jul 2003 - 12:59 GMT - DanielBonniot
Parents: WebHome > FeatureProposals
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.