S
San
Hi,
I wrote two simple constructors (one of them default) to initialize a
student object.
Student::Student(string name)
{
student_name = name;
student_id = LATEST_ID + 1;
student_address("");
student_phone(0);
student_email("");
}
Student::Student()
{
student_name("");
student_id = LATEST_ID + 1;
student_address("");
student_phone(0);
student_email("");
}
When I try to use the following:
Student stud_1("San");
The g++ compiler gives an error message "undefined message to
Student::Student(basic_string(char, string_char_traits(char),
_default_alloc_template(0,0)))"
The compiler has no problem if I use Student stud_1();
Is the trouble due to the fact that I am trying to assign a string and
that there is no copy constructor defined?
Any help would be greatly appreciated.
Thanks,
San
I wrote two simple constructors (one of them default) to initialize a
student object.
Student::Student(string name)
{
student_name = name;
student_id = LATEST_ID + 1;
student_address("");
student_phone(0);
student_email("");
}
Student::Student()
{
student_name("");
student_id = LATEST_ID + 1;
student_address("");
student_phone(0);
student_email("");
}
When I try to use the following:
Student stud_1("San");
The g++ compiler gives an error message "undefined message to
Student::Student(basic_string(char, string_char_traits(char),
_default_alloc_template(0,0)))"
The compiler has no problem if I use Student stud_1();
Is the trouble due to the fact that I am trying to assign a string and
that there is no copy constructor defined?
Any help would be greatly appreciated.
Thanks,
San