C. Keywords, Commands, Variable Types, & Container Types Flashcards
1
Q
break
A
- When encountered inside of a loop, immediately stops the execution of the loop and jumps to the first statement following the loop.
2
Q
catch
A
- Designates the commands to be executed in response to an exception generated in a preceding “try” block.
3
Q
class
A
- Used to define a class. The general format is: class class_name {/* class description */};
4
Q
const
A
- Indicates that a variable will not change values; particularly useful for passing by const reference
5
Q
continue
A
- When encountered inside of a loop, immediately stops the execution of that iteration of the loop and begins the next iteration (if any)
6
Q
delete
A
- Frees up dynamically allocated memory that was previously allocated with new
7
Q
else
A
- Designates the commands to follow if an if condition evaluates to false
8
Q
extern
A
- Indicates that the definition for a function or class will be provided outside of the current file.
9
Q
for
A
- Loop designator that provides a compact way of specifying all loop control in one place. The keyword is followed by parentheses containing 3 clauses sparated by semicolons: an initialization clause executed before the first iteration, a conditional to check at the beginning of each possible iteration, and an update clause to indicate what should change with each iteration. Alternatively, the parentheses can contain variable and container to iterate over, separated by a colon; the variable will take on each value from the container.
10
Q
friend
A
- Designates that a function defined outside a class should have access to a class’s members as though it were part of the class
11
Q
if
A
- Identifies the start of a condition. The keyword is followed by parentheses containing a Boolean (the condition), and following that are any commands to execute if the condition is true and, optionally, an else clause.
12
Q
namespace
A
- Designates a namespace to be used when creating classes or functions or, when coupled with using, when referring to a class or function.
13
Q
new
A
- Allocates new memory dynamically (on the heap)
14
Q
operator
A
- Used to designate an operator that will be overloaded
15
Q
private
A
- Indicates that subsequent class variables and functions should be private (accessible within that class only)
16
Q
protected
A
- Indicates that subsequent class member variables and functions should be protected (accessible to a class and its derived classes only)
17
Q
public
A
- Indicates that subsequent class member variables and functions should be public (accessible to anything)
18
Q
return
A
- Specifies the value to return from a function
19
Q
static
A
- Indicates a varable that should persist across multiple calls to a function. Static variables will maintain their value from the previous call to a function on subsequent calls rather than allocating a new local variable with each function call
20
Q
struct
A
- An alternative to a class. Traditionally used only for grouping member variables, it now provides the same functionality as a class
21
Q
try
A
- Designates a section of code that should be executed but that might generate exceptions. Exceptions are handled by code in a subsequent catch block
22
Q
typedef
A
- Defines a new name to be used for a type; allows a user to use more compact and meaningful type names.
23
Q
using
A
- Indicates a namespace to be used by default so that namespaces do not need to be specified explicitly for every command.
24
Q
virtual
A
- Indicates that a function in a class can be defined more specifically in derived (children) classes.