Operator overloading in Object Oriented Programming? 

Q. 1 What is operator overloading in Object Oriented Programming? 
C++ language has the ability to provide the operators with a special meaning for a data type. This mechanism of giving such special meanings to an operator is known as Operator overloading. It provides a flexible option for the creation of new definitions for C++ operators. 

Q. 2 List out the operators that cannot be overloaded in Object Oriented Programming? 
1. Class member access operator (. and .*) 
2. Scope resolution operator (::) 
3. Size operator ( sizeof() ) 
4. Conditional operator ( ? : ) 


Q. 3 Discuss different rules for operator overloading in Object Oriented Programming? 
1. In operator overloading the existing operators can be overloaded. 
2. In operator overloading, the overloaded operator must have at least one operand that is of user defined data type. 
3. In operator overloading, the basic meaning of the operator should not be changed. 
4. In operator overloading, the overloaded operators follow the syntax rules of the original operators. 
5. The original meaning and syntax of the operator cannot be overridden. 


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: