Multiple Inhertiance - Unfortunate Consequences

(see also the Java version)

#include < string.h>
#include < iostream.h>

class Person
{
public:
  Person () {}
  Person (char *n) { strcpy(name, n); }
  virtual char *toString() { return name; }
  virtual char *idString() {}

private:
   char name[128];
};

class Student : public virtual Person
{
public:
   Student (char *n, char *i) : Person (n) { strcpy(id,i); }
   char *toString()
   {
      char *tmp = new char[1024];
      strcpy(tmp, Person::toString());
      strcat(tmp, " Today");
      return tmp;
   }
   char *idString()
   {
      char *tmp = new char[1024];
      strcpy(tmp,id);
      return tmp;
   }

private:
   char id[20];
};

class Employee : public virtual Person
{
public:
   Employee (char *n, char *i) : Person (n) { strcpy(id,i); }
   char *idString()
   {
      char *tmp = new char[1024];
      strcpy(tmp,id);
      return tmp;
   }

private:
   char id[20];
};

class StudentEmployee : public Student, Employee
{
public:
   StudentEmployee (char *n, char *i)
   : Student (n,i), Employee(n,i) {}
   char *idString() { return Student::idString(); } // needed
};

class SecondStudentEmployee : public Student, Employee
{
public:
   SecondStudentEmployee (char *n, char *i)
   : Student (n,i), Employee (n,"999"), Person (n) {}
   char *idString() { return Employee::idString(); } // needed
};

int main()
{
   Student *joan = new Student("Joan","100");
   cout << joan->toString() << "\n";
   StudentEmployee *john = new StudentEmployee("John","123");
   SecondStudentEmployee *jim = new SecondStudentEmployee("Jim","124");
   cout << john->toString() << "\n";
   cout << jim->toString() << "\n";
   cout << john->idString() << "\n";
   cout << jim->idString() << "\n";
}