473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

pointer to a Class initialization question

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

Oct 27 '06 #1
1 1320
2005 wrote:
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

Oct 27 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bryan Parkoff | last post by:
I create one 32 Bits variable and four pointer variables. Four pointer variables link or point to one 32 Bits variable. Each pointer variable is 8 Bits. Look at my example below. unsigned int...
4
by: DaKoadMunky | last post by:
I was recently looking at some assembly code generated by my compiler. When examining the assembly code associated with constructors I noticed that the dynamic-dispatch mechanism was enabled...
4
by: Steven T. Hatton | last post by:
I mistakenly set this to the comp.std.c++ a few days back. I don't believe it passed the moderator's veto - and I did not expect or desire anything different. But the question remains: ISO/IEC...
3
by: sathyashrayan | last post by:
The standard confirms that the following initialization of a struct struct node { --- --- } struct node var = {NULL};
35
by: tuko | last post by:
Hello kind people. Can someone explain please the following code? /* Create Storage Space For The Texture */ AUX_RGBImageRec *TextureImage; /* Line 1*/ /* Set The Pointer To NULL...
5
by: Grahamo | last post by:
Hi, I have a basic question regarding some legacy code I'm working with; Basically the code looks something like this. I'd like to know if there are any reasons why a particular approach is...
21
by: Roman Werpachowski | last post by:
I can't understand this: double * x = new double; const double * p = x; delete p; works. Why am I allowed to delete a const pointer? On the same note: why am I allowed to do this: class...
4
by: craig | last post by:
During construction of an object "parent", if you create a subobject that stores a pointer to the parent (through the "this" pointer), will that pointer be valid when the subobject is later called?...
1
by: ank | last post by:
Hi, all. I've come to think of the idea of automatic initialization/deinitialization of non-local reference count pointer. I've made an assumption that the user of the pointer only read...
14
by: Glen Dayton | last post by:
While looking at some old code I ran across a snippet that increments a pointer to access different members of a structure: .... struct Badness { std::string m_begin; std::string m_param1;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.