please help

<<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
{
cout<<ID<<" "<<name<<" "<<"has GPA = "<<GPA << '\n';
}
It looks like you missed to add << between the variable GPA and the string literal "\n".
closed account (1CfG1hU5)
even with

#include <iostream>

using namespace std; <-- put this before function main

lol i realized that i forgot that thing..........but i got a new error

any ideas?
closed account (1CfG1hU5)
what's new error?
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 )
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 = 0; 

name is a std::string so it doesn't make sense giving it the value 0.
Last edited on
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??
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.
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
Topic archived. No new replies allowed.