up previous next contents
Next: Interfaces Up: Extending Classes Previous: Extending classes: how and   Contents

Subsections

Designing a class to be extended

  • Choose the access for each part of a class design carefully: public, protected, private.
  • If your design will have subclasses, design your protected parts carefully.

Bad effects of public fields

  • Fields can be modified at any time by a programmer.
  • No way to add functionality.

Non-final classes have two interfaces

  • Public interface for programmers using the class.
  • Protected interface for programmers extending the class.


up previous next contents
Next: Interfaces Up: Extending Classes Previous: Extending classes: how and   Contents