Advertisements
Advertisements
Question
Describe the syntax of an Operator Function.
Code Writing
Short Answer
Advertisements
Solution
The general form of operator function is,
return-type class_name::operator op(argument list)
{
function body//task defined
}
Where return type refers to the value returned by the given operation, and op refers to the operator being overloaded. The keyword operator comes before the operation. The function is called Operator op. Operator functions must be member (non-static) or friend functions.
shaalaa.com
Is there an error in this question or solution?
