84 Chapter 6: Classes and Objects
Why is an abstract data type abstract?
Because there is no concept of representation involved – an abstract data type speciﬁes thebahviour of values of the type, it does not say how the type should be represented in a speciﬁcimplementation.
How is the state of an object represented?
By the values associated with ﬁelds declared in the class.
What is object identity?
The identity of an object is the way that it is uniquely identiﬁed. For the
, references toobjects are the identities of the objects. Thus,
a == b
are variables that arereferences to objects, is only true if
refer to the same object, i.e. the identities of theobjects are the same.
What determines the public interface of an object?
The set of public methods.
for a set data type.
What are the rules for method overloading?
If two or more methods in a class have the same name but different signatures then the methodis said to be overloaded. The signature of the methods is determined by the number and type ofthe parameters to the method. The return type of the methods is not considered to be part ofthe signature for the purposes of overloading.
Why should instance variables not be made public?