1 / 5

Abstract Classes and Methods

Abstract Classes and Methods. An abstract class is one which the programmer never intends to instantiate. Concrete classes, classes intended to be instantiated. Abstract classes. Too generic to create real objects Reduce dependency on concrete class code Made abstract by key word “abstract”

dyllis
Télécharger la présentation

Abstract Classes and Methods

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Abstract Classes and Methods An abstract class is one which the programmer never intends to instantiate. Concrete classes, classes intended to be instantiated.

  2. Abstract classes • Too generic to create real objects • Reduce dependency on concrete class code • Made abstract by key word “abstract” • Contains abstract methods ( cannot be static) • Abstract methods do not contain implementations.

  3. Example abstract class Public abstract class Shape exends Object{ Public double getArea() { return 0.0; } Public double getVolume() { return 0.0; } Public abstract String getName(); }

  4. Abstract Classes • JHTP chapter 10 slides 16-34

  5. Interface • Jhtp chapter 10 51-59

More Related