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!