Professional Documents
Culture Documents
Thought Process
Chapter 1
§ Encapsulation
§ Inheritance
§ Polymorphism
§ Composition
2
Object Wrappers
• Non-portable code
• etc,.
3
What is an Object?
4
Procedural Programming
5
Unpredictable?
6
Nice Packages
7
Data and Behaviors
8
O-O Programming
9
Object Data
10
Object Behaviors
11
Object Behaviors
12
What Exactly Is a Class?
13
What Exactly Is a Class?
An object cannot be
instantiated without a
class.
– Classes can be
thought of as the
templates, or cookie
cutters, for objects as
seen in the next
figure.
14
Higher Level Data Types?
int x;
float y;
15
Modeling a Class in UML
16
Method Signatures
17
Program Spaces
18
Encapsulation
19
Encapsulation
20
Interfaces
21
Interfaces
22
Implementations
23
Inheritance
24
Mammal Hierarchy
25
Superclasses and Subclasses
26
Mammal Hierarchy
27
Is-a Relationships
28
Polymorphism
29
Polymorphism
30
Polymorphism
31
Polymorphism
32
Polymorphism
33
Shape UML Diagram
34
Composition
35
Composition
36
Composition
37
Has-a Relationships
38
Has-a Relationships
39
Has-a Relationships
40