4. Engineering C++ Software Solutions Flashcards

1
Q

What is a template type? Example?

A

A template type is a special type that can take on different types when the type is initialized.

std::vector uses a template type and can be of type int, char, etc.

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

What is a “friend” declaration?

A

A friend declaration grants a function or another class access to private and protected member variables.

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

What is inheritance?

A

Inheritance allows a class to inherit all member functions and data from a class into a derived class.

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

True or false?

When a derived class is initialized, the derived class must construct the base class.

A

True.

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

When a base class is inherited, what does/doesn’t the derived class have access to?

A

The derived class can access public members of the base class, but not private members.

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

What is an initializer list and what is it used for?

A

An initializer list is the syntax to initialize the base class. It is used to:

  • initialize a base class
  • initialize the current class using another constructor
  • initialize the default values of member variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly