LearnFrenzy
Sign in Take a free test

Operator Overloading · Operator Overloading MCQ · Question 9

Does overloading change precedence? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 9 Back to Exercise

After overloading + and * for a Vec class, how is a + b * c evaluated?

  • A Left to right: (a + b) * c
  • B a + (b * c) – precedence is unchanged Correct
  • C It depends on the order of definition
  • D It does not compile
Correct Answer: Option B

Precedence, associativity and arity come from the grammar, not from your functions.

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