I have write this constructor to initialize the character type array
class StudentInfo
{
char* vuId;
public:
StudentInfo(char* vu_Id)
{
setVuId(vu_Id);
}
void setVuId(char* vu_Id)
{
vuId = new char[strlen(vu_Id) + 1];
strcpy(vuId, vu_Id);
}
};
This code is working fine. but I want to initialize without having to call setVuId function. Is there anyway to do it?