Term
|
Definition
declare structure of class |
|
|
Term
|
Definition
|
|
Term
|
Definition
|
|
Term
main is a "free function" means |
|
Definition
it exists without/outside of any class |
|
|
Term
|
Definition
like the java import statement system: <> user: " " |
|
|
Term
|
Definition
ofstream out; out.open("numbers.txt"); out << "Hello, world!" << endl; out.close(); |
|
|
Term
class level (static) members |
|
Definition
class variable: shared by all instances of class class constant: (final) shared by all instances of class class method: does not operate on specific object |
|
|
Term
|
Definition
outside the scope of any function or class |
|
|
Term
|
Definition
global vars, static class member cars, static local vars stored in GLOBALS AREA |
|
|
Term
|
Definition
parameters, non-static (normal) local variables stored in CALL STACK |
|
|
Term
|
Definition
dynamically allocated (with new) stored on heap |
|
|
Term
why using globals is shitty |
|
Definition
who knows who/what is responsible for setting values not self-contained not easy to update program |
|
|
Term
|
Definition
is necessary, unlike in java, so use delete to get rid of ur shit when you are about to orphan something |
|
|
Term
|
Definition
when u don't delete inaccessible objects off the heap |
|
|
Term
|
Definition
static: fixed in size, declare via int A[100] dynamic: on heap, with new int*B = new int[100] |
|
|
Term
|
Definition
|
|
Term
passing parameters: general rules |
|
Definition
all individual values and objects are passed by value, only arrays are automatically passed by reference because they are really just pointers anywho |
|
|
Term
|
Definition
makes it so can't modify that |
|
|
Term
|
Definition
just write template before class declaration, and then use T for things to write it's member functions, have to put template before again |
|
|
Term
|
Definition
Time& Time::operator+=(const Time& other) { stuff } binary ones (like +) should be written as free functions because more flexible |
|
|
Term
|
Definition
order of types of parameters, return type (need these to overload operators) |
|
|
Term
|
Definition
class A can be accessed by method B.m if A grants B "friend" status |
|
|
Term
principle of data abstraction |
|
Definition
a user's code should not access the implementation details of the class used |
|
|
Term
|
Definition
object that enables a user to loop through a container without violating the principle of data abstraction |
|
|
Term
public, private, protected, friend |
|
Definition
public: can be accessed anywhere private: can only be accessed within the class protected: private but can be accessed in subclasses too friend: all members of A can be accessed by B.m method if A grants B friend status |
|
|
Term
|
Definition
type that will be replaced by the template argument when the container object is defined |
|
|
Term
how to overload post increment |
|
Definition
pass in dummy parameter
Iterator itr(nodePtr); nodePtr = nodePtr -> next; return itr; |
|
|
Term
|
Definition
method that deallocates the space occupied by an object ~Linked(); |
|
|
Term
|
Definition
|
|
Term
generic algorithms operate on containers through iterators |
|
Definition
|
|
Term
sequential container classes |
|
Definition
items are stored in succession, from first to last |
|
|
Term
|
Definition
finite sequence of items such that 1. item at index can be accessed/modified in constant time 2. insert/delete at back takes constant time on avg |
|
|
Term
|
Definition
|
|
Term
|
Definition
~cost, total number of statements executed in any sequence of n calls to the method, divided by n |
|
|
Term
|
Definition
finite sequence of items such that 1. item at index can be accessed/modified in constant time 2. insert/delete at front or back takes constant time on avg
very similar to vector |
|
|
Term
|
Definition
finite sequence of items such that 1. access/modify arbitrary item takes linear time 2. given iterator to position, insert/delete takes constant time |
|
|
Term
why not use [ ] with list |
|
Definition
|
|
Term
choose vector/ deque or list |
|
Definition
vector/deque: access/modify at different positions list: insert/delete at iterated through positions |
|
|
Term
|
Definition
in constructor make a field in it too iterator(list_node* x): node(x) { } initialize iterator's node field to x |
|
|
Term
equality: reference, value, or user-specific semantics |
|
Definition
reference: same address value: different objects with identical contents user-specific: based on certain field or whatever |
|
|
Term
|
Definition
container in which: 1. insert only at back 2. delete/modify only at front FIFO no iterator deque is default, can also do lists |
|
|
Term
|
Definition
calls methods from some other class to define its methods (ex: queue, stack) |
|
|
Term
|
Definition
container in which only item that can be removed/accessed/modified is at top (most recently inserted) works with vector, deque, list, deque is default |
|
|
Term
|
Definition
info saved for calling function in case it goes back to it and needs to continue with something |
|
|