c_cpp 为emplyee / manager系统设计一个结构。员工属于经理。一位经理有几名员工。他们也可能属于

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 为emplyee / manager系统设计一个结构。员工属于经理。一位经理有几名员工。他们也可能属于相关的知识,希望对你有一定的参考价值。

// the following design is not done yet. Just an initial thought

class People {
protected:
    string name;
    unsigned int age;
    string title;
public:
    People();
    virtual ~People();
};

class Manager : public People {
private:
    vector<Employee*> emp;
    Manager* mngr;
public:
    void enhance_moral();
};

class Employee : public People {
private:
    Manager* mngr;
public:
    void work();
};

class Sys {
private:
    vector<Manager*> managers;
    vector<Employee*> employees;
public:    
    void fire_people(People& p);
    void promote_employee(const Employee& e);
    
};

以上是关于c_cpp 为emplyee / manager系统设计一个结构。员工属于经理。一位经理有几名员工。他们也可能属于的主要内容,如果未能解决你的问题,请参考以下文章