Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

28. Could we change operations priority while overloading?

Posted on 2015-01-24
5
Medium Priority
?
107 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 1000 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 1000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

876 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