Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Object Oriented Programming – Abstract classes and Interfaces Chapter 27.

Similar presentations


Presentation on theme: "Advanced Object Oriented Programming – Abstract classes and Interfaces Chapter 27."— Presentation transcript:

1 Advanced Object Oriented Programming – Abstract classes and Interfaces Chapter 27

2 Purpose: to simplify the design of medium to large sized programs Advanced OOD concern with the identification of class structures and inheritance

3 Chapter facilities: Interfaces: “neatest” way for programs to deal with events Abstract classes

4 Abstract classes – set up a class to be reused Example program “Rectangle” See Author’s web site. Rectangle” extends “Shape” which is an abstract class Declaring a class abstract forces programmer who uses it (via inheritance,) to provide missing methods – which “enforces” a particular design

5 Interfaces Used in “Balloon” Public interface Balloon { … Note NO class An interface describes only the services provided by the class public class Spheroid implements Balloon …

6 Compiler checks to see if it complies with the interface declaration Examples: Programs that use Buttons implement ActionListeners and Scrollbars AdjustmentListeners

7 Interface can be used to describe classes in a program Inheritance structure “Is a” relationship Can Not describe: Implementations of methods Classes which use other classes (“has a”) relationship

8 Multiple Inheritance Some languages (C++) not Java Java allows multiple implementations Example programs: “Entertainment” and program “TV” which extends “Entertainment”

9 Interfaces versus abstract classes 1. Abstract classes can provide implementation of one or more methods 2. Can implement more than one interface but only extend (inherit) from one abstract class 3. An interface is something that is used at compile time to perform checking 4. Abstract class implies it’s methods will be fleshed out by the class that extends it

10 Designing multithreaded programs 1. Use methods described in chapter 21 2. Analyze applications to see activities that need to be carried out in parallel 3. Identify those objects that need to be threads 4. Identify the nature of the interaction between threads (independent, mutual, exclusion, producer-consumer)

11 Other approaches: Information systems: examples Airline ticket reservation system Real time systems Fly by wire Knowledge based systems AI Parallel or concurrent systems Any computer systems that can carry on two or more tasks simultaneously Mathematical “complex” processing Games especially those with good graphics


Download ppt "Advanced Object Oriented Programming – Abstract classes and Interfaces Chapter 27."

Similar presentations


Ads by Google