Initialize following nested class

Based on the following classes below.
I need to create a customerqueue object which consists of customer object.
How do I go about creating customer queue objects and initialize their values using the customer constructor in the main function.
Eg. CustomerQueue male;

ct = other, customer ( "tom",15) <<< Customer constructor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class Customer
{
    public:

    // default constructor
    Customer ();
    // One for senior
    Customer (char[MAX] , int );
    // One for lady
    Customer (char[MAX] , char);
    // One for other
    Customer (char[MAX] );
    // copy constructor
    Customer (const Customer& );
    // To print out the customer
    void displayCust ();
    // Some other useful functions

    private:

    char *name;
    int age;
    char sex;
};



enum CustomerType {Senior, Lady, Other};


class CustomerQueue
{
    public:
    CustomerQueue ();
    ~CustomerQueue ();
    CustomerQueue (const CustomerQueue&);
    void enqueue (Customer );
    Customer dequeue ();
     // four isEmpty functions
    bool isGenEmpty () const;
     // four printQueue functions
    void displayQueue();
     // some other useful functions

    int getNo ();

    private:
    struct Node;
    typedef Node* NodePtr;
    struct Node
    {
         CustomerType ct;
         Customer cust;
         NodePtr next;
	};

	NodePtr head,tail;


	void addToTail (Customer );
	Customer removeFromHead ();
    static int no;
};
Last edited on
Topic archived. No new replies allowed.