🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Operators and Templates: all 10 questions

Quiz: Operators and Templates · Question 1 of 10

Why is operator<< usually a non-member (often friend) function?

Why is operator<< usually a non-member (often friend) function?

  1. A.It's faster
  2. B.Its left operand is the output stream, not your class
  3. C.Members can't return references
  4. D.It must be static
Answer & explanation

Correct answer: Its left operand is the output stream, not your class

cout << x means operator<<(cout, x), so it can't be a member of x's class.

Can you get the rest right without peeking?

Take the timed Quiz: Operators and Templates quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →