1.

What is the syntax of overloading operator + for class A?(a) A operator+(argument_list){}(b) A operator[+](argument_list){}(c) int +(argument_list){}(d) int [+](argument_list){}I got this question by my college professor while I was bunking the class.My question is from Operator Overloading topic in portion Source Files, Classes and Operator Overloading in C++ of C++

Answer»

The CORRECT ANSWER is (a) A OPERATOR+(argument_list){}

The EXPLANATION is: The general SYNTAX for operator overloading is:

 return_type operator_keywordOperator(argument_list){}

eg.

 A opeartor+(argument_list){}



Discussion

No Comment Found

Related InterviewSolutions