English

Describe the syntax of an Operator Function. - Computer Science 1

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?
2016-2017 (March)
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×