Interfaces Versus Abstract Classes

   

Java™ 2 Primer Plus
By Steven Haines, Steve Potts

Table of Contents
Chapter 8.  Interfaces


Sometimes there is some confusion about when to use interfaces and when to simply create abstract methods and place them in a super class. Here are a few guidelines:

  • Use an abstract base class method when the functionality is tightly coupled with the object itself

  • Use an interface when the functionality is auxiliary to the object

  • Use an interface when the functionality can be applied globally to other unrelated objects


       
    Top
     



    Java 2 Primer Plus
    Java 2 Primer Plus
    ISBN: 0672324156
    EAN: 2147483647
    Year: 2001
    Pages: 332

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net