M/F 2:30-3:20 |
CS 1130: Transition to OO Programming Spring 2016 |
Main
About: Overview Announcements Staff Consultants Calendar Materials: Texts DrJava Terminology Lectures: In-Class Web-Based VideoNote Assessment: Grading Assignments Labs Resources: CMS Piazza (link) Piazza (about) Java API Style Guide Academic Integrity |
Module 2, Part 5Advanced OO ConceptsThe concepts of abstract classes and abstract methods solve two problems that arise in developing a system of classes and subclasses. The interface is used to define methods that a class that wants to "implement the interface" must define. ContentsAbstract Classes and Methods
Reading:
Gries/Gries, Sec. 4.7, pp. 163–164. Comments: Make a class abstract so that it cannot be instantiated (instances of it cannot be created). All you can do is make subclasses of it. Within an abstract class, make a method abstract so that it must be overridden in every subclass (that is not itself abstract). 2. Interfaces
Reading:
Gries/Gries, Sec. 12.1–12.3, pp. 335–344. Comments: You need not study this material. It is presented because the interface is an important mechanism in Java, and it is used in describing and implementing "abstract data types". It will be used heavily in CS211. An interface gives the syntax of some methods, and any class that "implements" the interfaces must define these methods. Interfaces provide a useful mechanism for signaling that a class will definitely implement certain methods. |