The constructor without parameters work but the other one does not. I'm very desperate, I tried everything
// header
class Etudiant
{
private:
char * name;
unsigned int age;
Date *datenaissance;
public:
Etudiant();
Etudiant(char * c,unsigned int,Date&);
~Etudiant();
};
this is my .cpp
Etudiant::Etudiant()
{
this->name = new char();
strcpy(name, "kabil");
this->age = 18;
this->datenaissance = new Date();
}
Etudiant::Etudiant(char * c, unsigned int a, Date &d)
{
this->name = new char();
strcpy(this->name,c);
this->age = a;
this->datenaissance = new Date(d);
}
Etudiant::~Etudiant()
{
delete[]name;
name = 0;
}
this is my main
int main()
{
Date d();
Etudiant E(),E1("student",15,d);
system("pause");
}
what should I change?