hello,
i need help to solve this little problem.
i have an error here.."cant access privet members declared in class CWorker..with is another class
void main()
{
CManager *Sasson = new CManager("Sasson Sassoni");
assert(Sasson);
// adds workers
Sasson->addWorker("Jojo");
Sasson->addWorker("Shilgiya", 1000);
}
i also have CManager.h...
in CManager.cpp, its only part very i got the problem.
void CManager::addWorker(const char *name,int salary)
{
int i;
for(i=0;i<m_numOfWorkers;i++);
CWorker* p=m_pWorker;
m_pWorker=new worker[i+2];
assert(m_pWorker);
memcpy(m_pWorker,p,(i+1)*sizeof(worker));
delete []p;
worker.m_wName=name;
worker.m_wSalary=salary;
m_pWorker[i]=worker;
}
class CWorker
{
public:
// default constructor
CWorker(const char*,int salary=0);
CWorker();
private:
char m_wName[LEN_W];
int m_wSalary;
};
#endif
class CManager
{
int m_mSalary;
char m_mName[LEN_M];
CWorker *m_pWorker; // pointer to list of workers
int m_numOfWorkers; // number of workers subject to this manager
public:
// constructor
CManager(const char* , int salary=60000,int num=0);
//defult constructor
CManager();
// copy constructor
CManager(const CManager&);
// destructor
~CManager();
// adds one new worker at the end of the list
void addWorker(const char*,int salary=0,CWorker&);
// find worker by name
//CWorker findWorker(const char* );
// show manager details including list of workers*/
void showManager()const;
// delete a worker from the list
/*deleteWorker(???)
// updating the manager salary
void setMangerSalary(int);
// updating the manager name
void setManagerName(const char* name);
// retrieves the current manager
const CManager&getCurrentManager()const; */
};
#endif
if you could help me please ,
thank you,
michael