Oct 11, 2014 at 10:07am UTC
<<ambiguous overlead for 'operator= ' in '((student*)this) -> student::name = 0'>>
This error is in the line below.
---------------------------------------
student::student()
{
name = 0;
ID = 0;
numberOfCourses = 0;
}
---------------------------------------
Here is the class:
---------------------------------
class student
{
public:
void setClass(int, string, int);
void setStruct(int , double);
void calculateGPA( );
void print( )const;
student();
student(int, string, int);
private:
string name;
int ID, numberOfCourses;
double GPA;
};
----------------------------------
Any ideas what the problem might be?
Thank you for your supports <3
Last edited on Oct 11, 2014 at 10:17am UTC
Oct 11, 2014 at 10:09am UTC
{
cout<<ID<<" "<<name<<" "<<"has GPA = "<<GPA << '\n';
}
Oct 11, 2014 at 10:09am UTC
It looks like you missed to add << between the variable GPA and the string literal "\n".
Oct 11, 2014 at 10:15am UTC
even with
#include <iostream>
using namespace std; <-- put this before function main
Oct 11, 2014 at 10:16am UTC
lol i realized that i forgot that thing..........but i got a new error
any ideas?
Oct 11, 2014 at 10:18am UTC
i changed the previous question to the new one.
(im sorry im new here still learning the function of the site so i thought this is how i submit a new question XD )
Oct 11, 2014 at 10:25am UTC
i thought this is how i submit a new question XD
It makes the thread hard to follow. Now the two first replies doesn't make much sense so people might think we are stupid :o ... just kidding ;)
name is a std::string so it doesn't make sense giving it the value 0.
Last edited on Oct 11, 2014 at 10:25am UTC
Oct 11, 2014 at 10:28am UTC
lol im really sorry about that this literally my first hour on this site bare with me :P
sooo i should make (name) without any value or should i assign it to something?
and if i should assign it to something can you give an example??
Oct 11, 2014 at 10:31am UTC
The default constructor of std::string creates an empty string if you want the string to be empty you don't have to do anything.
Oct 11, 2014 at 10:33am UTC
got it.
thanx allot man i really appreciate it :D
have been trying to solve this damn problem for a whole week :/
Much love bro <3