Solved

28. Could we change operations priority while overloading?

Posted on 2015-01-24
5
64 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

895 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

20 Experts available now in Live!

Get 1:1 Help Now