What does this error mean?

I have encountered a following error, may i know what does it mean?
pointTwoD.h:14: note: candidates are: pointTwoD& pointTwoD::operator=(const pointTwoD&)


below are the code snippets for pointTwoD.cpp and pointTwoD.h

pointTwoD.h

#include <iostream>
#include <string>
#include "locationData.h"



using namespace std;


class pointTwoD
{
private:
int xCord;
int yCord;
locationData data;
float civiIndex;

public:
void setxCord(int);
void setyCord(int);
int getxCord();
int getyCord();
//void getLocationData();
};



pointTwoD.cpp

#include "pointTwoD.h"


void pointTwoD::setxCord(int x)
{

xCord=x;

}

int pointTwoD::getxCord()
{
return xCord;

}

void pointTwoD::setyCord(int y)
{
yCord=y;

}

int pointTwoD::getyCord()
{
return yCord;

}
Well since you haven't overloaded the assignment operator for pointTwoD, and your error is stating something about it, I can only assume that there is code using this class that is not posted that is causing the compiler to implicitly try to do something with it. Copy and paste the exact error message, also, post the call sites for this class as well as the Location class.
okay, the exact error message is this

pointTwoD.h:11: note: candidates are: pointTwoD& pointTwoD::operator=(const pointTwoD&)


locationData.h

#ifndef LOCATIONDATA_H
#define LOCATIONDATA_H


#include<iostream>
#include<string>




using namespace std;

class locationData
{
private:


string sunType;
int noOfEarthLikePlanets;
int noOfEarthLikeMoons;
float aveParticulateDensity;
float avePlasmaDensity;

public:
void setSunType(string);
string getSunType();
void setNoOfEarthPlanets(int);
int getNoOfEarthPlanets();
void setNoOfEarthMoons(int);
int getNoOfEarthMoons();
void setAveParticulateDensity(float);
float getAveParticulateDensity();
void setAvePlasmaDensity(float);
float getAvePlasmaDensity();
float computeCivicIndex(string,int,int,float,float);
string toString();


};
#endif


locationData.cpp
#include "locationData.h"



void locationData::setSunType(string sun)
{
sunType=sun;

}
string locationData::getSunType()
{
return sunType;
}
void locationData::setNoOfEarthPlanets(int earthNo)
{
noOfEarthLikePlanets=earthNo;

}

int locationData::getNoOfEarthPlanets()
{
return noOfEarthLikePlanets;

}
void locationData::setNoOfEarthMoons(int moonNo)
{

noOfEarthLikeMoons=moonNo;
}

int locationData::getNoOfEarthMoons()
{
return noOfEarthLikeMoons;

}

void locationData::setAveParticulateDensity(float partDensity)
{
aveParticulateDensity=partDensity;

}

float locationData::getAveParticulateDensity()
{
return aveParticulateDensity;
}

void locationData::setAvePlasmaDensity(float plasDensity)
{
avePlasmaDensity=plasDensity;
}

float locationData::getAvePlasmaDensity()
{
return avePlasmaDensity;
}

string locationData::toString()
{

string s=getSunType();
s+=getNoOfEarthPlanets();
s+=getNoOfEarthMoons();
s+=getAveParticulateDensity();
s+=getAvePlasmaDensity();



}

these 2 classes locationData and pointTwoD are to be used in my main class


main.cpp

#include <iostream>
#include <string>
#include "locationData.h"
#include "pointTwoD.h"


using namespace std;




void showProgram()
{
cout<<"Welcome to Mission Plan program!"<<endl<<

"1)Input statistical data."<<endl<<
"2)Compute civ. index value (for all records)"<<endl<<
"3)Print top 5 exploration destinations."<<endl<<
"4)Print total travel distance."<<endl;



}


int main()
{
pointTwoD dataStore[100];
pointTwoD getData;
int counter=0;
locationData data;
string sunT;
int xCord,yCord,noOfEarthPlanet,noOfEarthMoon;
int choice;
float aveParticulateDensity;
float avePlasmaDensity;
showProgram();
cout<<"Please select your choice :";
cin>>choice;


switch(choice)
{
case 1 : cout<<"Input statistical data"<<endl;


cout<<"Please enter x-cordinate:";
cin>>xCord;
getData.setxCord(xCord);
cout<<"Please enter y-cordinate:";
cin>>yCord;
getData.setyCord(yCord);
cout<<"Please enter sun type: TYPE:";
cin>>sunT;
data.setSunType(sunT);
cout<<"Please enter no. of earth-like planets:";
cin>>noOfEarthPlanet;
data.setNoOfEarthPlanets(noOfEarthPlanet);
cout<<"Please enter no. of earth-like moons:";
cin>>noOfEarthMoon;
data.setNoOfEarthMoons(noOfEarthMoon);
cout<<"Please enter ave. particulate density (%-tage):";
cin>>aveParticulateDensity;
data.setAveParticulateDensity(aveParticulateDensity);
cout<<"Please enter ave. plasma density (%-tage):";
cin>>avePlasmaDensity;
data.setAvePlasmaDensity(avePlasmaDensity);

dataStore[counter]=data.toString();
counter++;

cout<<"Record succesfully stored. Going back to main menu."<<endl;


break;

default: cout<<"Invalid choice, please re-enter your choice."<<endl;

case 2:
data.computeCivicIndex(sunT,noOfEarthPlanet,noOfEarthMoon,aveParticulateDensity,avePlasmaDensity);
cout<<"Computation completed"<<endl;



}


return 0;

}


i have done it the way like in the locationData class, it works fine but i have no idea why this error appears when i try to link them together
Put your code in code tags, to the right of where you type your comments are these brackets <>, select the text you want in code and press that.

Here is your problem:
dataStore[counter]=data.toString(); dataStore[counter] is a pointTwoD and data.toString() returns a string, the compiler is telling you that there is a candidate operator, the assignment operator that it could use for this statement, however, the compiler will only give you a default operator... this is why it is just a candidate because you don't have operator=(const std::string&) for your pointTwoD class. Either implement it or change your logic there.
hmm, i see. Then how do i go about for the assignment to solve this issue?
Topic archived. No new replies allowed.