LearnFrenzy
Sign in Take a free test

Operator Overloading · Operator Overloading MCQ · Question 10

Can you overload operator+ for two ints? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 10 Back to Exercise

Can you write int operator+(int a, int b)?

  • A Yes
  • B No – at least one parameter must be a class or enumeration type Correct
  • C Only inside a namespace
  • D Only as a friend
Correct Answer: Option B

Otherwise you could change the meaning of built-in arithmetic.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links