Cで継承をシミュレートしていますが、正確な方法がわかりません。EmployeeとDirectorの2つの構造体を作成しました。ここで、DirectorはEmployeeから「継承」することになっています。通常の従業員と取締役の両方を保持できるアレイを作成するにはどうすればよいですか?これは機能しませんでした:
Employee workers[3]
以下は、Director構造体のコードです。
typedef struct {
Employee employee;
int bonus;
} Director;