CSE
1720
Lecture 6
Aggregation, Graphics IV
Announcements:
•
Lectures 7-10 assigned reading: Ch 9, JBA
2
Goals/
To do:
•
How to create,
copy
, and
delegate to aggregates
–
example aggregates:
Pixel
,
Picture
,
Graphics2D
•
Create, modify
, and iterate
over collections
•
Implement traversal over a
collection
•
Implement search within a
collection
•
Use services of
Graphics2D
for drawing
Goals/
To understand:
•
recognize aggregates from
their APIs
•
characterize and distinguish
between two traversal
techniques
•
distinguish between aliases,
shallow copies, and deep
copies of aggregrates
•
understand the characteristics
of the “current settings”
graphical model
3
Today’s Topic
•
Issues with making a copy of an aggregate
4
This
preview
has intentionally blurred sections.
Sign up to view the full version.
The Aggregation Relationship
•
A class
C
is said to be an
aggregate
if and only if one of
its attributes is an object reference (say of type
T
)
•
Aggregation
is the name of the relationship between
C
and
T
.
–
an object of type
C
HAS-A
object of type
T
–
the object of type
T
is called the
aggregated part
•
Key observation:
–
it is possible that the object of type
T
can be may have a
different lifetime of the object of type
C
•
We will demonstrate this next…
(but to do this we must first explain the
Stock
and
Investment
classes)
5
The class
Stock
•

This is the end of the preview.
Sign up
to
access the rest of the document.
- Winter '12
- Baljko
- Subroutine, Bravo Company, Object copy
-
Click to edit the document details