COP2253 Zybooks Chapter Seven Flashcards
object
a grouping of data (variables) and operations that can be performed on that data (methods)
abstraction (or information hiding or excapsulation)
means to have a user interact with an item at a high-level, with lower-level internal details hidden from the user
ADT
abstract data type
class
defines a new type that can group data and methods to form an object
public member methods
indicate all operations a class user can perform on the object
creating an object consists of two steps:
declaring a reference variable of the class type, and assigning the variable with an explicitly allocated instance of the class type
new operator
explicitly allocates an object of he specified class type
member access operator
”.” used to invoke a method on an object
private fields
variables that member methods can access but class users cannot
class members
collectively, a class’ fields and methods
method definition
provides an access modifier, return type, name, arguments, and the method’s statements
mutator (setter)
method may modify a class’ fields
accessor (getter)
method accesses but may not modify a class’ fields
constructor
a special class member that is called when an object of that class type is created and which can be used to initialize all fields (has the same name as the class and has NO return type)
default constructor
a constructor called without any arguments