What is the purpose of using brackets with new and delete? - ANSIf you allocate memory with
brackets, you must delete that memory using brackets. If not, the results are "undefined
behavior."
What is encapsulation? - ANSgrouping data and/or functionality together
What is the purpose of a constructor? - ANSa function used to initialize an object that is called
only once, when an object is initially created
What is the name of the pointer of the invoking object (e.g. the object which called the function)?
- ANS"this"
What is the name of the function that gets called when an object falls out of scope? -
ANSDestructor
What is an accessor? - ANS"get" functions; retrieve something from the class
What is a mutator? - ANS"set" functions; change something about the class
What are the public/private keywords used for? - ANSPublic: everyone can access; good for
functions and accessors
Private: the default; only the class itself (i.e. functions within the class) can access
How do you create a constant variable? - ANSconst type* variableName
How do you pass constant parameters? - ANSfunction(const type parameter)
How do you protect a class function from modifying "this"? - ANSCreating a const class makes
"this" read only
What is a constant pointer? - ANSprotects the thing the pointer is pointing to; protects the
pointer itself; or both
What does the new keyword do? - ANSdynamically allocates memory at run-time
What does the delete keyword do? - ANSremoves memory allocated with new when you are
done with it. Use when your program no longer needs something
What is a memory leak? - ANSMemory which is allocated, but never deallocated (or freed) by
the program