Wk. 11 Flashcards
Why can overloaded operators call private members?
Because the calling object and the parameter are of the same data type (eg. CBox)
Where are friend prototypes placed?
Inside the class declaration
What is the syntax for friend declarations?
Friend [data type] [function identifier] [parameter list]
What are the some of the pointer operators?
& - the address operator
* - the dereference operator
How do you release the space in the heap?
delete [variablePTR]
What is the syntax for a class function in a implementation file? (separate from header file)
[return type][tag name]:: [function identifier] (parameter list)
What does the implementation syntax look like for a set function of a class CBox?
void CBox::SetWidth()
What happens when an object enters or exits a function by value?
The copy ctor is called
What happens if a class has no ctors declared?
The compiler will generate a default ctor if one is needed.
What is the phrasing of the & operator?
“The address of…”
What is the phrasing of the * operator?
“Whatever is pointed to by…”