Home > Back-end >  Overloaded C ()
Overloaded C ()

Time:09-21

Why in class reloading after () returns a value to add reference operator & amp; (see the following declarations and definitions)??????? And could you tell me the () and show me the details of the [] of overloading, thank you!
 CComlpex& Operator () (const CComlpex& C1, const CComlpex& C2) 
{
Return CComlpex (c1. Real + c2. Real, c1. Image + c2. The image).
}

CodePudding user response:

Quotation marks just shows function returns a reference type, rather than the value of the copy,

CodePudding user response:

Please tell me the detail the overloading, or don't understand

CodePudding user response:

After the return value to add reference operator & amp; Because there is no copy the return value, on the contrary, returns the object itself, for example:

Int& ABC (int a, b int, int, c int& The result)

{
Result=a + b + c;
return result;
}//right
Int& ABC (int a, b int, int) c

{
return a + b + c;
}//wrong, for copying the return value
  • Related