What's wrong with this code?

class LongitudeLatitude : public std::pair<double,double>
{
public:
static const double earthRadius = 6353; //Earth Radius in km
double computeDistance (const LongitudeLatitude & thePoint); //Distance in km
};


'variable' : only static const integral data members can be initialized within a class

The problem is earthRadius is indeed static and const. So where did I do wrong?
double isn't an integral type. You must initialise earthRadius outside of the class definition as in:
double LongitudeLatitude::earthRadius = 6353.0;
Topic archived. No new replies allowed.