C++ Flashcards

1
Q

Pointer to constant data

A

const int * a; int const * a;

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

Pointer with constant memory address

A

int * const a = 0xFFFFFFFF;

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

Pointer to constant data and constant address

A

const int * const a = 0xFF; int const * const a = 0xFF;

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

In-line IF (conditional operator)

A

condition ? trueResult : falseResult

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

Comma Operator

A

a = (b=3, b+2); -> b=3; a=b+2;

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

Function Pointer

A

int (*fn)(int,int)

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

Operator Overloading

A

ReturnType operator + (OperandType);

ReturnType ClassName::operator+ (OperandType x) { }

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

static Class Members

A

Shared by all instances of the class

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

friend Functions

A

These are allowed to have access to private and protected class members

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

friend Class

A

These are allowed to have access to private and protected class members

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

What are not inherited?

A

constructor, destructor, operator overloads, friends

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

Inheritence Syntax

A

class X: public Y, public Z {}

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

virtual Members

A

Class member that can be redefined in child classes

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

Templates

A

template functionOrClass;

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

dynamic_cast

A

Cast of pointer from dervied to base class, checks that the object will be compatible

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

static_cast

A

Cast between derived and base classes, no check that the object is compatible

17
Q

reinterpret_cast

A

Cast of pointers of any type

18
Q

const_cast

A

Adds or removes ‘const’ keyword from a pointer

19
Q

Memory allocation on the stack

A

alloca