26 AFraction(
int numerator,
int denominator) : mNumerator(numerator), mDenominator(denominator) {}
27 AFraction(
int number): mNumerator(number), mDenominator(1) {}
29 AFraction& operator+=(
int number) {
30 mNumerator += number * mDenominator;
34 AFraction operator+(
int number)
const {
40 AFraction& operator-=(
int number) {
41 mNumerator -= number * mDenominator;
45 AFraction operator-(
int number)
const {
51 AFraction& operator*=(
int number) {
56 AFraction operator*(
int number)
const {
62 AFraction& operator/=(
int number) {
63 mDenominator *= number;
67 AFraction operator/(
int number)
const {
75 return mNumerator / mDenominator;
79 float toFloat()
const {
80 return float(mNumerator) / float(mDenominator);
83 double toDouble()
const {
84 return double(mNumerator) / double(mDenominator);