Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.2k views
in Object Oriented Programming with C++ by (49.1k points)
closed by

What are the rules for operator overloading?

1 Answer

+1 vote
by (54.8k points)
selected by
 
Best answer

Following are some rules to be followed while implementing operator overloading.

1. Precedence and Associativity of an operator cannot be changed.

2. No new operators can be created, only existing operators can be overloaded.

3. Cannot redefine the meaning of an operator’s procedure. You cannot change how integers are added. Only additional functions can be to an operator.

4. Overloaded operators cannot have default arguments.

5. When binary operators are overloaded, the left hand object must be an object of the relevant class.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...