what this error message says?
Hi all,im trying to use references on my 2D point class.And after having tens of error,i could reduce it to one.But i cant get rid of it.Can anyone tell me why i have this error massage ?
Code:
Code:
#ifndef TPOINT2D_H_
#define TPOINT2D_H_
//#include <cmath>
#include <math.h>
#define PI 3.14159265358979
using namespace std;
class TPoint2D
{
public:
explicit TPoint2D( const double &coord1=0.0 ,const double &coord2=0.0 );
double Distance(TPoint2D &pointA, TPoint2D &pointB);
double TPoint2D::Ro();
double TPoint2D::Phi();
double Ro(TPoint2D pointA);
double Phi(TPoint2D pointA);
TPoint2D::TPoint2D(const double &coord1 , const double &coord2 );
const double & TPoint2D::Coord1();
const double & TPoint2D::Coord2();
private:
double coord1_,coord2_;
};
TPoint2D::TPoint2D(const double &coord1 , const double & coord2):coord1_(coord1),coord2_(coord2){};
inline const double & TPoint2D::Coord1()
{
return coord1_;
}
inline const double & TPoint2D::Coord2()
{
return coord2_;
}
double TPoint2D::Ro()
{ return sqrt (Coord1()*Coord1()+
Coord2()*Coord2());
}
double TPoint2D::Phi()
{
return atan2 (Coord1(),Coord2()) ;
}
double Distance(TPoint2D pointA, TPoint2D pointB)
{
return sqrt((pow((pointA.Coord1()-pointB.Coord1()),2)+
pow((pointA.Coord2()-pointB.Coord2()),2)));
}
double Ro(TPoint2D pointA)
{
return pointA.Ro();
}
double Phi(TPoint2D pointA)
{
return pointA.Phi();
}
#endif /*END OF TPOINT2D_H_*/
Error Message:
Code:
TPoint2D.h:23: error: `TPoint2D::TPoint2D(const double&, const double&)' and `TPoint2D::TPoint2D(const double&, const double&)' cannot be overloaded