|
-
January 6th, 2010, 11:48 AM
#1
Array of Object Pointers
I am having trouble getting Access Violation errors when I try to manipulate an array of object pointers.
I am trying to maintain an array of object pointers as a member of a class. I want to access the objects in the array in many different member methods in the class. I have a method specifically for initializing the elements in the array as necessary:
void ApplicationQueueHandler::createLocalQueue(qc::LocalQueue* lq, std::string queueName)
{
qc::SubscriptionManager subs(session);
subs.subscribe(*lq, queueName);
}
This method is used:
localAppQueues[localQueueCount] = new qc::LocalQueue;
qc::LocalQueue* lq = localAppQueues[localQueueCount];
createLocalQueue(localAppQueues[localQueueCount], queueName);
localQueueCount++;
And "localAppQueues" is declared in the header file as: qc::LocalQueue* localAppQueues[100];
In another method, when I try to use one of the stored object pointers (e.g. "qc::Message m = localAppQueues[i]->get()", I get an Access Violation.
Is there an obvious issue with how I am creating/passing the pointers that is causing this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|