Chapter 13
(T/F) Class objects can be defined prior to the class declaration.
Falsw
This is automatically called when an object is destroyed.
destructor function
Members of a class object are accessed with the
dot operator
The process of object-oriented analysis can be viewed as the following steps:
identify objects, then define objects' attributes, behaviors, and relationships
Class declarations are usually stored here.
in their own header files
Objects in an array are accessed with ________, just like any other data type in an array.
subscripts
The constructor function always has the same name as
the class
A c++ class is similar to one of these.
structure
This directive is used to create an "include guard," which allows a program to be conditionally compiled. This prevents a header file from accidentally being included more than once.
#ifndef
When you dereference an object pointer, use the
-> operator
(T/F) A destructor function can have zero to many parameters.
False
(T/F) More than one destructor function may be defined for a class.
False
(T/F) The constructor function may not accept arguments.
False
(T/F) You must declare all data members of a class before you can declare member functions
False
(T/F) You must use the private access specification for all data members of a class.
False
(T/F) A private member function is useful for tasks that are internal to the class, but is not directly called by statements outside the class.
True
(T/F) If you do not declare a destructor function, the compiler will furnish one automatically.
True
(T/F) More than one constructor function may be defined for a class.
True
(T/F) OOP is centered around the object, which encapsulate together both the data and the functions that operate on the data.
True
(T/F) One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.
True
(T/F) One purpose that destructor functions are often used for is to free memory that was allocated by the object.
True
(T/F) When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.
True
(T/F) When using smart pointer to dynamically allocate objects in c++, it is unnecessary to delete the dynamically allocated objects because the smart pointer will automatically delete them.
True
(T/F) Whereas OOP centers on the object, procedural programming center on functions.
True
In OOP terminology, an object's member variables are often called its ________, and its member functions are sometimes referred to as its behaviors, or ________.
attributes, methods
When a member function is defined outside of the class declaration, the function name must be qualified with the:
class name, followed by the scope resolution operator
A ____ is a member function that is automatically called when a class object is ____
constructor, created
A class is a ___ that is defined by the programmer
data type
In a procedural program, you typically ___ stored in a collection of variables, and a set of ___ that perform operations on the date.
data, functions
Objects are created from abstract data types that encapsulate ___ and ___ together.
data, functions
When a constructor function accepts no arguments, or does not have to accept arguments because of default arguments, it is called a(n) ________.
default constructor
Assuming that Rectangle is a class name, the statement Rectangle *BoxPtr;
defined a Rectangle pointer variable called BoxPtr
When the body of a member function is defined inside a class declaration, it is said to be
inline
The constructors function's return type is
none of these
The destructor's return type is
nothing, destructors have no return type
A class may have this many default constructor's
only one
If you do not declare an access specification, the default for members of a class is
private
This type of member function may be called from a statement that is a member of the same class
private
This is used to protect the important data
private access specifier
Examples of access specifiers are the key words:
private and public
This type of member function may be called from a statement outside the clas
public
If a local variable and a global variable have the same name within the same program, the ___ resolution operator must be used.
scope