Wk. 11 Flashcards

1
Q

Why can overloaded operators call private members?

A

Because the calling object and the parameter are of the same data type (eg. CBox)

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

Where are friend prototypes placed?

A

Inside the class declaration

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

What is the syntax for friend declarations?

A

Friend [data type] [function identifier] [parameter list]

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

What are the some of the pointer operators?

A

& - the address operator
* - the dereference operator

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

How do you release the space in the heap?

A

delete [variablePTR]

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

What is the syntax for a class function in a implementation file? (separate from header file)

A

[return type][tag name]:: [function identifier] (parameter list)

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

What does the implementation syntax look like for a set function of a class CBox?

A

void CBox::SetWidth()

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

What happens when an object enters or exits a function by value?

A

The copy ctor is called

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

What happens if a class has no ctors declared?

A

The compiler will generate a default ctor if one is needed.

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

What is the phrasing of the & operator?

A

“The address of…”

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

What is the phrasing of the * operator?

A

“Whatever is pointed to by…”

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