Pointer to Pointer member function call

I am creating a simulation involving a queuing system. The queue consists of a pointer-pointer vector of ClassA in ClassB, this handles all the data changes, referenced to an array of ClassAs, objects that enter queue, via a pointer vector of ClassA, the queue itself. The problem I am having is the program crahsing when the pointer-pointer calls members.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
// In main

// queue points to array
ClassA array[10];
vector<*ClassA> queue;

// In ClassB

// queuePtrPtr points to queue 
vector<**ClassA> queuePtrPtr;

// Member calls
(**queuePtrPtr).m_x;
(*queuePtrPtr)->GetX();


My IDE, Visual Studio 2008, doesn't recognize a syntax error of the member calls. How am I doing this wrong?
Last edited on
quePtrPtr is declared as a vector, not a pointer to a pointer (it only contains pointers to pointers to ClassA). You should do something like this:

1
2
3
int index = 0; //or any valid index for quePtrPtr
(**queuePtrPtr[index]).m_x;
(*queuePtrPtr[index])->GetX();
Topic archived. No new replies allowed.