Chapter 4 - Writing Classes Flashcards
SR 4.1
What is an attribute?
v
SR 4.2
What is an operation?
An operation is a function that can be done to or done by an object. For example, one operation of a Student object might be to compute that student’s current grade point average. Collectively, an object’s operations are referred to as the object’s behaviors.
(In Java, an object’s operations are defined by methods declared within a class.)
SR 4.3 List some attributes and operations that might be defined for a class called Book that represents a book in a library.
v
SR 4.4
v
SR 4.5
What is the difference between an object and a class?
A class is the blueprint of an object. It defines the variables and methods that will be a part of every object that is instantiated from it. But a class reserves no memory space for variables. Each object has its own data space and, therefore, its own state.
SR 4.6
v
SR 4.7
v
SR 4.8
v
SR 4.9
v
SR 4.10
v
SR 4.11
v
SR 4.12
v
SR 4.13
v
SR 4.14
v
SR 4.15
v