More on Classes Flashcards

1
Q

method chaining

A

where several member functions can be called on the same object in a single expression

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

this

A

inside ever (non-static) member function, the keyword this is a const pointer that holds the address of the current implicit object

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

*this

A

we can have function return this by reference in order to enable method chaining

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

where should class definitions be written?

A

in a header file with the same name as the class

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

where should trivial member functions (access functions, constructors with empty bodies etc.) be defined?

A

inside the class definition in the header

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

where should non trivial member functions be defined

A

in the source (.cpp) file with the same name as the class

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

nested type

A

a type that is defined inside a class type (also known as a member type)

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

member type

A

a type that is defined inside a class type (also known as a nested type)

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

Can member functions defined inside a class template definition use the template parameters of the class template?

A

yes

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

Can member functions defined outside a class template definition use the template parameteres of the class template?

A

no, they must resupply a template parameter declaration, and shold be defined (in the same file) just below the class template definition

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

static member variables

A

static duration members that are shared by all objects of the class.

Static members exist even if no objects of the class have been instantiated.

Prefer to access them using the class name, the scope resolution operator and the members name

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

How do you initialise a static member inside the class definition?

A

Make the static members inline

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

static member functions

A

member functions that can be called with no object. They do not have a *this pointer, and cannot access non static data members

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

friend declaration

A

can be used to tell the compiler that some other class or function is a friend

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

friend

A

a class or function (member or non-member) that has been granted full access to the private and protected members of another class

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

friend function

A

is a function (member or non-member) that can access the private and protected members of a class as though it were a member of that class

17
Q

friend class

A

a class that can access the private and protected members of another class