Operator Overloading  «Prev

Friend functions in C++ - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 
1. A friend function declaration:
  A. gives nonmember functions access to hidden class members
  B. is another term for an overloaded function within a class
  C. is any function created for you by the compiler (such as a default constructor)
  D. is any function outside the class with the same name as a function in the class

2. A friend function declaration appears:
  A. in the header of the friend function outside the class
  B. inside the class declaration to which it is a friend
  C. as a separate declaration inside main()
  D. anywhere prior to the function invocation

3. How is a static member function similar to a friend function?
  A. A static member function is like a friend function that doesn't need to be public:.
  B. A friend function is similar to binary operator overloading.
  C. A friend function has an implicit this parameter .
  D. A friend function does not have direct access to the class’s 1) private: and 2) protected: parts.

Correct answers:

Your Score: 0