cant understand error..help plz

#include<iostream>
#include<conio.h>
using namespace std;
class distance
{
private:
int feet;
float inches;
public:
distance():feet(0),inches(0)
{}
void getdist()
{
cout<<"Enter feet: ";
cin>>feet;
cout<<"\nEnter inches: ";
cin>>inches;
}
void showdist()
{
cout<<endl<<feet<<"\""<<inches<<"\'";
}
void adddist(distance,distance);
};
void distance::adddist(distance d1,distance d2)
{
inches=d1.inches + d2.inches;
feet=0;
while(inches>=12)
{
inches-=12;
feet++;
}
feet+=d1.feet + d2.feet;
}
int main()
{
distance d1,d2,d3; \\***********************************
cout<<"Enter 1st distance parameters:-\n";
d1.getdist();
cout<<"\nEnter 2nd distance parmeters:-\n";
d2.getdist();
d3.adddist(d1,d2);
d3.showdist();
getch();
return 0;
}
the line showing stars in comment gives error..the compiler cant understand it..
use
// for comments.
oh no no not that problem i havent used comments in code actually its just for demonstration for u people to understand the problem..the compiler cant understand DISTANCE word in this line...
It doesn't know if you mean ::distance (your class) or std::distance. If you hadn't used using namespace std; in your code you wouldn't have got this problem.

To fix this either specify that you mean your class by writing
::distance d1,d2,d3;
or remove
using namespace std; (I recommend this solution)
got it..didnt know it..thankx alot sir..
Topic archived. No new replies allowed.