Hi! I have such a problem. I have created classes IT-company, HR-manager and Technical manager. They are linked with composition. Code:
class Technical_manager;
class Hr_manager;
class It_company
{
public:
It_company();
void get(void);
void set(void);
std::vector<Technical_manager> technical_manager;
std::vector<Hr_manager> hr_manager;
protected:
private:
std::vector<std::string> vacancyList;
std::string name;
};
class Hr_manager
{
public:
Hr_manager();
void prepareVacancyList(void);
void chooseCandidates(void);
void get(void);
void set(void);
protected:
private:
std::string name;
};
class Technical_manager
{
public:
Technical_manager();
void prepareTest(void);
void checkTest(void);
void holdingInterview(void);
void get(void);
void set(void);
protected:
private:
std::string name;
int requirementLevel;
int commutabilityLevel;
};
Also I have created constructors just like that:
It_company::It_company() :
Hr_manager(),
Technical_manager(),
name("NAME"),
vacancyList()
{
std::cout << "In constructor IT" << std::endl;
}
Hr_manager::Hr_manager():
name("Name")
{
std::cout << "In constructor HR" << std::endl;
}
Technical_manager::Technical_manager():
name("name")
{
std::cout << "In constructor Tm" << std::endl;
}
But Visual Studio 2013 return errors:
error C2614: ‘It_company’ : illegal member initialization: ‘Technical_manager’ is not a base or member
error C2614: ‘It_company’ : illegal member initialization: ‘Hr_manager’ is not a base or member
What should I do to solve this problem?
PS. It`s important to call Hr_manager() and Technical_manager() in It_company()
Please help!