Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE205 Lecture 08

CSE205 Lecture 08

Object-Oriented Programming and Data Structures
Interfaces
(202202)

Javier Gonzalez-Sanchez

September 18, 2021
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs CSE 205 Object-Oriented Programming and Data Structures Lecture 08:

    Interfaces Dr. Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 3 jgs

    Abstract Classes § cannot be instantiated and contains one or more abstract methods (no definition body). § can contain methods § can contain data declarations
  3. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 5 jgs

    Abstract Methods § An abstract method is a method without a body. § It cannot be final or static because there is no definition, and it should be changed later.
  4. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 8 jgs

    UML Class Diagram – abstract keyword
  5. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 10 jgs

    Interfaces § Interfaces contains behaviors that a class implements. § An interface cannot be instantiated § An interface does not contain any constructors. § In an interface, all methods are abstract. § An interface cannot contain instance fields. The only fields that can appear in an interface must be declared both static and final. § An interface is not extended by a class; it is implemented by a class. § An interface can extend multiple interfaces.
  6. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 16 jgs

    Polymorphism § A polymorphic reference is a reference variable that can refer to different types of objects at different points in time. § Polymorphic references are resolved at run-time, not during compilation.
  7. jgs CSE 205 Object-Oriented Programming and Data Structures Javier Gonzalez-Sanchez,

    Ph.D. [email protected] Fall 2021 Copyright. These slides can only be used as study material for the class CSE205 at Arizona State University. They cannot be distributed or used for another purpose.