Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify operators exercise #442

Merged

Conversation

bernhardmgruber
Copy link
Contributor

@bernhardmgruber bernhardmgruber commented Mar 8, 2023

  • provide definition of normalize()
  • provide two data members for numerator and denominator
  • remove addition operators
  • do not check whether *= can be chained

@bernhardmgruber bernhardmgruber force-pushed the simplify_fraction branch 2 times, most recently from f03b396 to 48d04af Compare March 8, 2023 16:22
code/operators/solution/operators.sol.cpp Outdated Show resolved Hide resolved
code/operators/solution/operators.sol.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the addition removed? Too much of the same?

code/operators/operators.cpp Outdated Show resolved Hide resolved
@bernhardmgruber bernhardmgruber force-pushed the simplify_fraction branch 2 times, most recently from 729a300 to 91e4845 Compare March 9, 2023 15:00
* provide definition of normalize()
* provide two data members for numerator and denominator
* remove addition operators
* do not check whether *= can be chained
@bernhardmgruber
Copy link
Contributor Author

Why is the addition removed? Too much of the same?

Exactly. I think just implementing operator* already teaches enough about operators. operator+ would just repeat that. On top, implementing operator+(Fraction, Fraction) is harder than the multiplication. And as @chavid pointed out in #439, should not be part of the exercise.

@bernhardmgruber bernhardmgruber merged commit 63c1a6a into hsf-training:master Mar 9, 2023
@bernhardmgruber bernhardmgruber deleted the simplify_fraction branch March 9, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants