c++ - this pointer, operator= and operator++ -


assignment based around operator= copy overloading, , learning objects. coding operator++ class.

the instructions are:

seti operator++( );   operator increases value of seti object's frequency   1 (to maximum of 9), before returning copy of itself.     note: frequency can never exceed 9. 

can this:

seti seti::operator++( ) {     seti temp;     temp = *this     if (temp.freq<9)     temp.freq+=1;     return temp; } 

thanks.

that doesn't match specified behavior, increase frequency of object operator++ called on.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -