Data Abstraction (Chap 6)

9/12/01


Click here to start


Table of Contents

Data Abstraction (Chap 6)

Objects

Classes

The class String

An example using String

Refined Palindrome Pseudocode

PPT Slide

PPT Slide

String is a bit special

String concatenation

String literals

Strings are immutable

A mutable class - StringBuffer

PPT Slide

Passing Objects to methods

PPT Slide

PPT Slide

PPT Slide

An Example: Playing Cards

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

Call by Value vs Call by Ref

PPT Slide

PPT Slide

PPT Slide

Elements of a Simple Class

PPT Slide

PPT Slide

Objects in memory

Instance variables and methods

Data Hiding

Accessing instance variables from outside the class breaks data hiding.

A better Counter.

public/private/default

Constructing objects

Adding constructors to Counter

Using constructors.

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

toString()

PPT Slide

The ADT Stack in Java

PPT Slide

PPT Slide

PPT Slide

Static fields and methods

PPT Slide

PPT Slide

Objects in memory

System.out.println()

Calling Methods

instance to instance

Why not static to instance?

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

The NON-OOP way to do it.

Scope

PPT Slide

PPT Slide

PPT Slide

Problem: Simulate a poker game

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

PPT Slide

OOD - CRC Cards

Using CRC Cards

CRC Cards for Checkers

Author: charlie

Email: charlie@cs.ucsc.edu

Home Page: http://www.cse.ucsc.edu/~charlie