I'm currently having an assignment, in which i need to create a DATABASE class,
which contains a employees pointers array, and private inner class,
that defines employees linked list
the goal to accomplish here, according to the assignment, is working acording
to a DB_TYPE defined constant.
when DB_TYPE = 0 i need my class methods to work with the employees pointers array,
when DB_TYPE = 1 i need my class methods to work with the employees linked list.
Therefore, i need two things:
1. Understanding constructor calling -
When i construct a new DATABASE object, for example with no paramaters,
the default constructor is called.
How do i call the linked list inner constructor to construct a Node, from the constructor itself?
2. Working according to the DB_TYPE constant -
I Suppose that's less of a trouble, as i can set my methods to work with
two cases\or with 'if' conditions regarding each value of DB_TYPE.
but if that's not that simple, i'll be glad to get some advise\help on how to do so.
EDIT: My Current code:
class DataBase {
public:
DataBase();
private:
Employee ** empArr; /*!< Employees pointers array */
unsigned int empCount;
Node head;
class Node{
public:
Node();
Node(Employee * emp, Node * next);
private:
Employee * emp; /*!< Employee Pointer */
Node * next; /*!< The next node (containing the next employee) */
};
};
Thanks,
Adiel