Operator overloading is —

2022

Operator overloading is —

  1. A.

    making new C++ operators

  2. B.

    making C++ operators work with objects

  3. C.

    giving C++ operators more than they can handle

  4. D.

    helping in reducing execution time

Attempted by 233 students.

Show answer & explanation

Correct answer: B

Operator overloading: Operator overloading allows existing C++ operators (for example +, -, *) to be given definitions that work with user-defined types (classes or structs). Key idea: You implement operator functions (such as operator+) to specify how an operator behaves for your class. These functions can be member functions or non-member functions.

Example: To add two Complex objects, define a function such as Complex operator+(const Complex& a, const Complex& b) that returns their sum.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs