user cannot modify or access a contained class directly, modification and access must happen
through the containing class. - Answers composition
in ______________ a contained class is disposed when a containing class is disposed - Answers
composition
in _______________ a contained class can function independently. - Answers aggregation
has a set size, is really fast, and is managed through the concept of scope - Answers the stack
Data is added to the stack by way of ____________ - Answers static allocation
___________ happens when data is stored on the heap rather than the stack. - Answers dynamic
allocation
the new keyword - Answers is a request from your program to the operating system for a safe
place to store some data
keyword that can be used against a pointer that points to heap space - Answers delete
steps to resizing an array - Answers - Create a new pointer that points to an area of heap space
initialized to the desired size.
- Copy the values from the old array to the new array.
- Delete the old array.
- Reassign the original pointer value to the new pointer value declared in step 1.
the automatics: - Answers - default constructor
- default destructor
- assignment operator
automatics - Answers program structures that happen automatically
deep copy - Answers copies statically allocated data members AND dynamically allocated data
members by setting up a separate heap space for the deep copy and then manually copying the
values in the RHS object's heap storage into that new allocation on the heap
shallow copy - Answers only copies statically allocated information
rule of three when using DMA: - Answers 1. copy constructor
2. deep copy assignment overload
, 3. destructor
copy constructor (rule of three): - Answers - creates an instance (i.e., an object) of the class'
type.
- takes in a parameter that is an object of the same type and copies the values from that
parameter into the newly created object
copies all of the data members from the preexisting object to the new object - Answers deep
copy assignment overload (rule of three)
destructor (rule of three): - Answers - delete statements that free up any dynamically allocated
memory that was allocated during the object's lifecycle
allows for algorithmic determination of the length of a c-style string - Answers null terminator
strlen - Answers returns the length of a string
strcpy - Answers Accepts two C-strings or pointers to two C-strings as arguments. The function
copies the second C-string to the first C-string. The second C-string is left unchanged.
strcmp - Answers compares two cstrings (case-sensitive)
represents a "is a" relationship between a base class and a derived class - Answers inheritance
syntax for declaring a derived class - Answers class DerivedClass : public BaseClass{};
"protected" - Answers any data members accessible to a derived class
when you re-implement a base class function on a derived class - Answers function overriding
when the compiler links declarations to definitions. - Answers binding
the _____ keyword can be used to force binding to link declarations to the most derived class'
implementation. - Answers virtual
virtual functions can be marked purely virtual by adding what? - Answers " = 0" to the declaration
any class that has at least one purely virtual function is called an - Answers abstract class
a ________ happens when you make an array of base class pointers, which can be set to
reference any base or derived class instance. - Answers polymorphic list
aggregation - Answers the practice of combining classes into a larger, more complex class
composition - Answers implemented the same as aggregation, but is a stronger relationship
passing a parameter into a function by value - Answers function makes a copy of the parameter
before anything else