An Introduction to Information Hiding
with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
toString()
methodequals()
and/or compareTo()
methodPictureFrame
class with public
attributes to someone they could use it improperlyget
(and are sometimes called "getters")set
(and are sometimes called "setters")PictureFrame
class
should be able to change the way the cost is calculated
without it having any impact on a user of the
classcalculateArea()
has been renamed getVisibleArea()
because there
is no reason for the user to know whether the area is
an attribute or a calulcated value)
PictureFrame
Class
PictureFrame
ClasstoString()
methodequals()
and/or compareTo()
method