Defines an overloaded + operator C ++

0

I could not solve the following question:

Fill in the blanks to define an overloaded + operator for the "Test" class.

Test Test::______(Test obj){
___newObj;
newObj.mem=
mem__obj.mem;
return newObj;
} 

I do not know how to fill in the spaces with the following attributes:  operator const Test class

Excuse me, I miss typing. the correct alternatives are as follows: class operator + const + Test

    
asked by anonymous 17.05.2017 / 20:12

1 answer

0

For the written code it is hard to understand but, will it Is this what you are trying to do?

Test Test::operator+ (Test obj) const
{
 Test newObj;
 newObj.mem = obj.mem;
 return newObj;
}
    
20.05.2017 / 01:13