0
#include<iostream>
using namespace std;
class distance
{private:
int feet1 ,inches1,feet2,inches2,sum1,sum2;
public:
void getdata()
{
cout<<"give the value of distance in inches and feet";
cin>>feet1>>inches1>>feet2>>inches2;
}
void add()
{sum1= feet1+feet2;
sum2=inches1+inches2;
}
void display()
{
cout<<sum1<<sum2;
}
};
int main()
{
distance x;
x.add;
x.display;
return 0;
}

I tried to write a program to add distance in feet and inches but it shows that reference to distance is ambiguous. Can someone help me out?

Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
  • 1
    BTW, please get into good habits early by formatting your code neatly and naming variables a bit better. – Ken Y-N Sep 12 '17 at 06:44
  • 1
    I suggest you learn about [`std::distance`](http://en.cppreference.com/w/cpp/iterator/distance), and think about what happens when you do `using namespace std;`. – Some programmer dude Sep 12 '17 at 06:44

0 Answers0