English
Tamil Nadu Board of Secondary EducationHSC Science Class 11

What are the rules for operator overloading? - Computer Science

Advertisements
Advertisements

Question

What are the rules for operator overloading?

Short Note

Solution

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

  1. The 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.
shaalaa.com
  Is there an error in this question or solution?
Chapter 15: Polymorphism - Evaluation - Section - D [Page 258]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 11 TN Board
Chapter 15 Polymorphism
Evaluation - Section - D | Q 1. | Page 258
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×