Introduction to Programming

Question #2

Read the question, compare the options, and review the correct answer below.

CS201 · Midterm#2

Which of the following statement is best regarding declaration of friend function?

  1. A
    Friend function must be declared after public keyword
  2. B
    Friend function must be declared after private keyword
  3. C
    Friend function must be declared at the top within class definition
  4. D
    It can be declared anywhere in class as these are not affected by the public and private keywords
Show correct answer

Correct answer: D. It can be declared anywhere in class as these are not affected by the public and private keywords

Check community answers against your course notes.
← More practice questionsTake a timed test