Question
Download Solution PDFOperator overloading in C++ is :
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFThe correct answer is Both (1) and (2)
Key PointsOperator overloading in C++ allows operators to have user-defined meanings on user-defined types (classes). This means:
- Making C++ operators work with objects: You can define the behavior of operators for your own classes, or objects. For example, you can define the '+' operator for a 'Fraction' class to perform fraction addition.
- Giving new meaning to existing C++ operators: By defining the operator's behavior for your classes, you are essentially giving new meaning to the existing operators for the context of your class.
Option (3) is incorrect because, C++ does not allow the creation of new operators, only new definitions for existing ones.
Last updated on Feb 15, 2025
-> The medical verification for Rajasthan Informatics Assistant Recruitment will be held on 17th February to 7th March 2025.
-> Rajasthan Informatics Assistant Notification was released for 3415 vacancies.
-> Candidates can check the Rajasthan Informatics Assistant Previous Year papers which helps in cracking the examination.
-> The applicants can also attempt the RSMSSB Informatics Assistant Test Series.