pointer to a Class initialization question

2

2005

Hi

I have two classes ( CNode & CAll ) and I created 2 objects for the
latter class, CAll.

CAll All_A, All_B;

class CAll {
public:

------

private:


CNode *m_pTop; // pointer to top of Allay (stack)
int mSize; // number of nodes in Allay (stack)
int mMaxSize; //max number of nodes in Allay (stack)
};

class CNode {
public:

------

private:
int m_ticketNum; // ticket number of car
CNode *m_pNext; // pointer to next node in stack
};

I have a pointer to All_B called *pB which I am expected to pass it to
a function.

I have trouble with *pB.

I did the following in the code:

CAll All_A, All_B; // initialize 2 objs All_A & All_B;
All_B pB;

But the above line is causing syntax error.

What is that I am missing?

The spec states that pB is a pointer to All_B.

Thanks
 
T

Thomas Tutone

2005 said:
I have two classes ( CNode & CAll ) and I created 2 objects for the
latter class, CAll.

CAll All_A, All_B;

class CAll {
public:

------

private:


CNode *m_pTop; // pointer to top of Allay (stack)
int mSize; // number of nodes in Allay (stack)
int mMaxSize; //max number of nodes in Allay (stack)
};

class CNode {
public:

------

private:
int m_ticketNum; // ticket number of car
CNode *m_pNext; // pointer to next node in stack
};

I have a pointer to All_B called *pB which I am expected to pass it to
a function.

I have trouble with *pB.

I did the following in the code:

CAll All_A, All_B; // initialize 2 objs All_A & All_B;
All_B pB;

If pB is supposed to be a pointer to All_B, then I assume the above
line should be:

CAll* pB = &All_B;

Best regards,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top