using namespace std;
The class Test
{
Public:
The Test (int=0);
//copy constructor
The Test (const Test&);
//overloaded operators
"+"The Test operator + (Test&);
//overload "=" operator
Test& Operator=(Test&);
//"()", is used to return the value of "Number"
Int operator () ();
Private:
Int Number;
};
//the constructor
The Test: Test (int Number_Parameter) : Number (Number_Parameter) {}
//copy constructor
The Test: Test (const Test& Test)
{
Number=test. The Number;
}
/* arithmetic function of a class */
The Test Test: : operator + (Test& Test)
{
Int Number_Parameter=0;
Number_Parameter=Number + test. The Number;
Return the Test (Number_Parameter);
}
/* */assignment operator function
//when overloaded operator "=" add "const" to parameters, application is not an error
Test& The Test: : operator=(Test& Test)
{
Number=test. The Number;
return *this;
}
Overloaded functions implement *//* ()
Int Test: : operator () () {return Number; }
Int main ()
{
Test_2 Test test_1 (1), (2), the Test (0);
//complains here: "no matching with the operands of operators"
Test=test_1 + test_2;
Cout & lt;