Chapter 14 More About Classes Flashcards

1
Q

If a member variable is declared ________, all objects of that class have access to the same variable.

A

Static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Static member variables are defined ________ the class.

A

Outside

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A(n) ________ member function cannot access any nonstatic member variables in its own class.

A

Static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A static member function may be called _______ any instances of its class are defined.

A

Before

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A(n) ________ function is not a member of the class, but has access to the private members of the class.

A

Friend

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A(n) _______ tells the compiler that a specific class will be declared later in the function.

A

Forward declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

________ is the default behavior when an object is assigned the value of another object of the same class.

A

Memberwise assignment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

A(n) ________ is a special constructor, called whenever a new object is initialized with another object’s data.

A

Copy Constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

_______ is a special built in pointer that is automatically passed as a hidden argument to all nonstatic member functions.

A

This

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

An operator may be _______ to work with a specific class.

A

Overloaded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When overloading the ________ operator, its function must have a dummy parameter.

A

Postfix increment (or decrement)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Making an instance of one class a member of another class is called ________.

A

Aggregation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Object aggregation is useful for creating a(n) ________ relationship between two classes.

A

Has a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Static variables cannot be accessed by nonstatic member functions. t/f

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Static member variables are defined outside their class declaration. t/f

A

true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A static member function may refer to nonstatic member variables of the same class, but only after an instance of the class has been defined. t/f

A

false

17
Q

When a function is declared a friend by a class, it becomes a member of the class. t/f

A

false

18
Q

A friend has access to the private members of the class declaring it a friend. t/f

A

true

19
Q

an entire class may be declared a friend of another class. t/f

A

true

20
Q

In order for a function or a class to become a friend of another class, it must be declared as such by the class granting it access. t/f

A

true

21
Q

If a class has a pointer as a member, it’s a good idea to also have a copy constructor. t/f

A

true

22
Q

You cannot use the = operator to assign one object’s values to another object, unless you overload the operator. t/f

A

false

23
Q

If a class doesn’t have a copy constructor, the compiler generates a default copy constructor for it. t/f

A

true

24
Q

If a class has a copy constructor, and an object of that class is passed by value into a function, the function’s parameter will not call its copy constructor. t/f

A

false

25
Q

The “this” pointer is passed to static member functions. t/f

A

false

26
Q

All functions that overload unary operators must have a dummy parameter. t/f

A

false

27
Q

For an object to perform automatic type conversion, an operator function must be written. t/f

A

true

28
Q

It is possible to have an instance of one class as a member of another class. t/f

A

true