An Introduction to Object-Oriented Programming
By Timothy Budd
Study Guide for Chapter 3
Learning Objectives
After reading this chapter, you should be able to:
-
Explain what is meant by encapsulation.
-
Describe various uses for classes in object-oriented programming.
-
Distinguish between the interface and implementation parts of
a C++ or Objective-C program.
-
Describe and compare the use of classes and methods in the various
languages we consider.
-
Write the interface and implementation parts for a simple program.
Study Questions
You may wish to use the print or save as command
on your web browser to produce a copy of this study guide.
That way you can fill in the answers to the questions as part of
your assimilating the information you learn in this chapter.
-
From the glossary,
find some of the synonyms for the following terms:
class,
instance,
instance variable,
method.
-
What is the difference between type declaration (or definition) and
variable instantiation?
-
What is the definition of an abstract data type?
How is an abstract data type related to a class?
-
What does it mean to say that an object is a combination of state
and behavior?
-
Give examples of classes used as a data manager, a data sink or source,
a view class, and a facilitator.
-
What are some of the reasons for separating a view class from the object
being viewed?
-
What information is contained on the front side of a CRC card,
and what information is written on the back side?
-
Explain some ways in which a class definition in C++ is similar to a
structure definition. In what ways are they different?
-
What is the difference between the public and the private portions
of a class description? Why should the public portion be listed first?
-
Does it make sense for the private portion of a class to be listed
in the interface file? Explain why or why not. Why is it required?
-
What is an inline function in C++? What are some of the advantages of
using an inline function? Why not make all functions inline?
-
In Objective-C, what does the data type id represent?
-
What is the Smalltalk browser?
-
In which of the programming languages we described must all new classes
be declared as subclasses of an already existing class?
-
Contrast the encapsulation provided by the class mechanism with the
encapsulation provided by the module facility. How are they different?
How are they the same?
(This question is duplicated in the exercises).
Contents copyright
Timothy Budd, 1995.