I have already write a fraction class,then I want to write a integer class,I hope I didn't need to write all the operator overloading function again(duplicatedefinition).
But I have some trouble doing that,could you help me correct my program,thank you very much.
Can I just let the denominator=1,then numerator will the same as an integer.
#include<iostream>
using namespace std;
class fraction
{
int fmu,fzi;//fmu is denominator,fzi is numerator
public:
fraction(){}
fraction(int fz,int fm=1)
{
fmu=fm;
fzi=fz;
}
void get(int &z,int &m);
void tongfen(int &z1,int &m1,int &z2,int &m2);
fraction yuefen(int &fz,int &fm);
fraction daoshu(int &fz,int &fm);