Professional Documents
Culture Documents
Comp401sp14lec04Motivating OO
Comp401sp14lec04Motivating OO
the
OO
Way
COMP
401,
Spring
2014
Lecture
04
1/21/2013
TriangleAreaApp
example
Write
a
program
that
reads
input
as
sequences
of
triangle
deni#ons.
TriangleAreaApp
ta.v01
Write
a
program
that
reads
input
as
sequences
of
triangle
deni#ons.
TriangleAreaApp
ta.v02
Write
a
program
that
reads
input
as
sequences
of
triangle
deni#ons.
TriangleAreaApp
ta.v03
Write
a
program
that
reads
input
as
sequences
of
triangle
deni#ons.
TriangleAreaApp
ta.v04
Write
a
program
that
reads
input
as
sequences
of
triangle
deni#ons.
ta.v06
Code
in
the
constructor
is
responsible
for
making
sure
that
the
elds
of
this
are
appropriately
set.
ta.v07
Must
use
this
keyword
if
another
local
variable
or
parameter
name
conicts
with
eld
name.
ta.v08
ta.v09
Which
means
it
is
the
data
type
of
any
variable
that
can
reference
the
object.
Objects
as
state
An
object
is
dened
by
its
state
Collec#on
of
named
elds
that
represent
informa#on
about
the
object
The
current
values
assigned
to
those
elds
reect
the
state
of
the
object