You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found it too too long. Few suggestions to better focus on operators only:
Provide in the original code the normalize() function and std::gcd stuff.
Provide int the original code the constructors, public attributes, constructors, assign method, and externals functions such as multiply, add, compare (returning -1,0,1 ?), print.
Ask to replace the functions with operators: =, +, *, <=>, <<
Then ask to add, reusing previous ones: !=, +=, *=.
Show that with <=> implemented, then <, <=, >, >= are automatically infered ?
Optionally, make all the assignments returning *this, like in operator<<, and explain this permit chaining.
Optionally, make them move the operators as inline friend functions, and make attributes private.
Optionnaly, discuss the pros and cons of making the unary constructor explicit.
I found it too too long. Few suggestions to better focus on operators only:
assignmethod, and externals functions such asmultiply,add,compare(returning -1,0,1 ?),print.