Ch. 13 Introduction to Classes Flashcards
The two common programming methods in practice today are _______ and _______.
Procedural programming, Object oriented programming
________ programming is centered around functions or procedures.
procedural
_________ programming is centered around objects.
Object oriented
_______ is an objects ability to contain and manipulate its own data.
encapsulation
In C++ the _______ is the construct used to create objects.
class
A class is very similar to a(n) ________.
structure
A(n) ________ is a key word inside a class declaration that establishes a member’s accessibility.
access specifier
The default access specification of class members is ________.
private
The default access specification of a struct in C++ is ________.
public
Defining a class object is often called the _________ of a class.
instantiation
Members of a class object may be accessed through a pointer to the object by using the ______ operator.
pointer
If you were writing the declaration of a class named Canine, what would you name the file it was stored in?
Canine.h
If you were writing the external definitions of the Canine class’s member functions, you would save them in a file named ______.
Canine.cpp
When a member functions body is written inside a class declaration, the function is ________.
inline
A ________ is automatically called when an object is created.
constructor
A _______ is a member function with the same name as the class.
constructor
________ are useful for performing initialization or setup routines in a class object.
constructors
Constructors cannot have a ________ type.
return
A _______ constructor is one that requires no arguments.
default
A(n) ________ is a member function that is automatically called when an object is destroyed.
destructor
A destructor has the same name as the class, but is preceded by a(n) ________ character.
tilde ~
Like constructors, destructors cannot have a _________ type.
return
A constructor whose arguments all have default values is a(n) ______ constructor.
default
A class may have more than one constructor, as long as each has a different _______.
Parameter list
A class may only have one default _________ and one ________.
Constructor, Destructor
A(n) ______ may be used to pass arguments to the consructors of elements in an objects array.
initialization list
Private members must be declared before public members T/F.
false
Class members are private by default. t/f
true
Members of a struct are private by default. t/f
false
Classes and structures in C++ are very similar. t/f
true
All private members of a class must be declared together. t/f
false
All public members of a class must be declared together. t/f
false
It is legal to define a pointer to a class object. t/f
true
You can use the new operator to dynamically allocate an instance of a class. t/f
true
A private member function may be called from a statement outside the class, as long as the statement is in the same program as the class declaration. t/f
false
Constructors do not have to have the same name as the class. t/f
false
Constructors may not have a return type. t/f
true
Constructors cannot take arguments. t/f
false
Destructors cannot take arguments. t/f
true
Constructors may have default arguments. t/f
true
Member functions may be overloaded. t/f
true
Constructors may not be overloaded. t/f
false
A class may not have a constructor with no parameter list, and a constructor whose arguments all have default values.
true
A class may only have one destructor. t/f
true
When an array of objects is defined, the constructor is only called for the first element. t/f
false
To find the classes needed for an object-oriented application, you identify all the verbs in a description of the problem domain. t/f
false
A class’s responsibilities are the things the class is responsible for knowing, and the actions the class must perform. t/f
true