While compiling the following code i am getting the error as
reference to 'distance' is ambiguous
#include<iostream>
using namespace std;
class distance
{
int feet,inches;
distance():feet(0),inches(0)
{
}
distance(int f,int i):feet(f),inches(i)
{
}
void show()
{
cout<<"feet "<<feet;
cout<<endl<<"inches "<<inches;
}
distance operator + (distance) ;
};
distance distance::operator + (distance d)
{
int f,i;
f=feet+d.feet;
i=inches+d.inches;
return distance(f,i);
}
int main()
{
distance d1;
distance d2(2,3),d3(7,5);;
d1=d2+d3;
d1.show();
}
can anyone help me with the error. And provide me the solution and as to why i am getting this error.