Solved

28. Could we change operations priority while overloading?

Posted on 2015-01-24
5
85 Views
Last Modified: 2015-02-12
Could we change operations priority while overloading?
0
Comment
Question by:Nusrat Nuriyev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 40568271
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
ID: 40568665
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
ID: 40568672
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
ID: 40606150
operators has priorities, can we change them at overloading?
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 250 total points
ID: 40606166
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

710 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