请帮我解决以下 C++ 设计问题
Class Office
{
std::list<Employees *> m_Employees;
string m_Address;
void AddEmployee(Employees *employee);
string GetAddress();
}
Class SalesOffice : public Office
{
int m_TotalEmployees_SalesPerYear;
int GetSalesPerYear();
}
Class FinanceOffice : public Office
{
int m_TotalEmployees_ProfitPerYear;
int GetProfitPerYear();
}
Class BookKeepingOffice : public Office
{
int m_TotalEmployees_RecordsPerYear;
int GetRecordsPerYear();
}
Class Employees
{
int id;
int GetID();
}
Class SalesEmployees : public Employees
{
int m_SalesPerYear;
int GetEmployeeSalesPerYear();
}
Class FinanceEmployees : public Employees
{
int m_ProfitPerYear;
int GetEmployeeProfitPerYear();
}
Class BookKeepingEmployees : public Employees
{
int m_RecordsPerYear;
int GetEmployeeRecordsPerYear();
}
班级办公室有一份班级员工名单。这种复合关系不能改变。显然,任何类型的办公室都只知道员工。问题:SalesOffice 的 GetSalesPerYear 如何访问 GetEmployeeSalesPerYear() 注意:我不想对每个办公室的员工进行类型转换。关于设计和设计模式的任何建议?