Solved

28. Could we change operations priority while overloading?

Posted on 2015-01-24
5
61 Views
Last Modified: 2015-02-12
Could we change operations priority while overloading?
0
Comment
Question by:Nusrat Nuriyev
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
Comment Utility
I am not quite sure what you mean here. Could you explain a bit more?
0
 
LVL 32

Accepted Solution

by:
phoffric earned 250 total points
Comment Utility
Are you talking about operator precedence? If so, then the answer is no. Overload as you wish, but the precedence of the operator is fixed in C++.
0
 
LVL 32

Expert Comment

by:phoffric
Comment Utility
I should have added that when two operators have the same precedence, then their associativity rules come into play, and that you cannot change those rules as well. (You know that to change the associativity, you use parenthesis.)
0
 

Author Comment

by:Nusrat Nuriyev
Comment Utility
operators has priorities, can we change them at overloading?
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 250 total points
Comment Utility
No, operator precedence is - as phoffric wrote above - 'carved in stone', See e.g. http://en.cppreference.com/w/cpp/language/operator_precedence

Operator precedence is unaffected by operator overloading.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now