Search:
Forum
General C++ Programming
Pointers in C
Pointers in C
Mar 23, 2011 at 5:10am UTC
saxophonemaster
(6)
I have a pointer that points to an array of MenuItem object pointers that points to MenuItem Objects
The following link should help explain what I am doing with class diagrams.
https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B11J5Ff0XQxgMjAzNzdjZTQtYTU1ZS00NzVlLWJjOWQtNGUxZjRlZDY2NzBi&hl=en&authkey=CJ7DmdQJ
In the header I have:
MenuItem **itemsp;
I am trying to initialize the array pointer in the class constructor that I am actually working with.
itemsp = *MenuItem [count];
I get the following error.
hw4.cpp: In constructor ‘Order::Order(int)’:
hw4.cpp:45: error: expected primary-expression before ‘[’ token
How do I initialize this?
Mar 23, 2011 at 6:26am UTC
aiby
(31)
I cant open the link.
Is Class MenuItem have an operator '[' member?
Mar 23, 2011 at 8:07am UTC
guestgulkan
(2942)
Assuming the menuitem array is being created dynamically using
new
then you need something like:
itemsp =
new
MenuItem* [count];
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs