Card Set Information
What is a class?
A class is a collection of a fixed number of components. (The type)
What is an object?
An object is an instance of a class. Can be a combination of variables, functions, and data structures.
What are methods?
Methods are member functions of a class.
What are data members?
Data members are members of a class that can hold a value.
How to overload methods
Use the same name but different parameters
What is a constructor?
Constructors initializes variables and assign dynamic memory.
What are destructors?
Inverse of a constructor. Called when objects are destroyed. Used to clean up when an object is no longer necessary.
How to overload constructors?
Give a function the same name but have different types or number of parameters.
Crectangle::Crectangle(int a, int b)
Why are destructors needed?
To deallocate memory and do other cleanup for a class object and its class members when the object is destroyed.
What is a copy constructor?
A special constructor for a class/struct that is used to make a copy of an existing instance.
What is a stack? What are the common methods for stacks?
Stacks are a type of container adaptor, specially designed in a LIFO context.
Common methods include: Top, push, pop, empty, size
What is a queue? What are the common methods for a queue?
A queue is a type of container adaptor, specially designed in FIFO context.
Common methods are: Front, back, push, pop, size, empty
What is an iterator?
An object that allows you to traverse a container, particularly lists.
What is the difference between the stack and the heap?
Heap(also known as the "free store") is a large pool of memory used for dynamic allocation.
Stacks are where parameters and local variables are allocated from.
What are arrays?
Series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
What are template classes, and what are the rules associated with them?
Allows a class to have members that use template parameters as types.
Templates whose functionality can be adapted to more than one type or class without repeating the entire code for each.
What does the delete keyword do?
Calls the destructor of the given argument, and returns memory allocated by "new" back to the heap.
What does the "new" keyword do?
Dynamically allocates memory from free store (or heap) and initializes the memory using the constructor.
What does pass by reference mean?
Reference to the location of the original argument is passed. This allow functions to modify the value of arguments that are being passed. No copy is made.
What does return by reference mean?
It returns a pointer to its return value.
What is cache?
Cache is used for temporary storage of data that is likely to be used again.
Big O Notation. O(log(n))
Divide and conquer
Big O Notation. O(n)
Does not depend on number of inputs