This commit is contained in:
Tobias Berger 2021-09-17 14:52:24 +02:00
parent 69874ba9f4
commit 7979b31d9b

View file

@ -35,6 +35,18 @@ namespace FractionNS {
this->m_numerator = numerator / gcd;
this->m_denominator = denominator / gcd;
}
Fraction::Fraction(int n) {
this->m_numerator = n;
this->m_denominator = 1;
}
Fraction::Fraction(float n) {
// TODO
throw std::runtime_error("Not yet implemented");
}
Fraction::Fraction(const Fraction& n) {
this->m_numerator = n.getNumerator();
this->m_denominator = n.getDenominator();
}
int Fraction::getNumerator() const { return m_numerator; }
int Fraction::getDenominator() const { return m_denominator; }