The Artima Developer Community
Sponsored Link

Interface Design by Bill Venners
Use abstract classes to provide default behavior or define a small family

Advertisement

Interface Design | Contents | Previous | Next

Abstract Classes



Figure 3-?. Inheritance and the state pattern.

It's really a tight-knit family thing. In the Java programming language, people can always use inner classes, which is a short hand of using composition, to get around multiple inheritance of implementation. If it feels more like a small family, go for the abstract class.

You force Canines into the Canine inheritance hierarchy. You limit client choices. What you are saying is that class Canine is a more narrow idea than interface Canine. If you use an abstract class, you are saying the concept is much more narrow, an interface, much more broad.


Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use