Open
Description
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 asmultiply
,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.
Metadata
Metadata
Assignees
Labels
No labels