0

hello!

I like to define the Distance class and overload binary + operator to add the two distances using friend function.

my program is here. But it does not work.

The error message said that "undefined symbol feet". What is the problem?

```
#include<iostream.h>
class Distance
{
int feet;
float inches;
public:
Distance()
{
feet=0;
inches=0.0;
}
Distance(int ft,float in)
{
feet=ft;
inches=in;
}
void showdata()
{
cout<<"\nFeet:"<<feet;
cout<<"\nInches:"<<inches;
}
friend Distance operator+(Distance );
};
Distance operator+(Distance d)
{
Distance temp;
temp.feet=feet+d.feet;
temp.inches=inches+d.inches;
while(temp.inches>=12)
{
temp.inches-=12;
temp.feet++;
}
return temp;
}
int main()
{Distance d3;
Distance d1(1,0);
Distance d2(1,1);
d3=d1+d2;
d3.showdata();
return 0;
}
```