Hi,
I wrote two simple constructors (one of them default) to initialize a
student object.
Student::Studen t(string name)
{
student_name = name;
student_id = LATEST_ID + 1;
student_address ("");
student_phone(0 );
student_email(" ");
}
Student::Studen t()
{
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::Studen t(basic_string( char, string_char_tra its(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::Studen t(string name)
{
student_name = name;
student_id = LATEST_ID + 1;
student_address ("");
student_phone(0 );
student_email(" ");
}
Student::Studen t()
{
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::Studen t(basic_string( char, string_char_tra its(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
Comment