Hello, I'm trying to grasp the concept of multiple pointers in C++.

For example, say we have a:

class A () { foo; }

...and later on in the program we have:

A* function1();

A** &operator[](char ) const {}

A*** var;


Now is the succession like this:

function1 --> &operator[] --> var

...or vice-versa?

At this point, the more I try to figure it out the more I'm asking, "Who's on first? What's on second, etc"
If I understand this correctly, function1 --> &operator[] --> var is not valid, here is why:

function1 is a function that returns a pointer to an object of class A, since function1 itself is not a pointer, so you would not derefernce function1. Again I could be wrong but this is my take.

You might use it like this:

A* pRet = function1();
cout << pRet->m_Value;

That is if the class A had a member m_Value, since pRet is a pointer to an A object.

A** &operator[](char ) const {}

Firstly, this is an operator overload. This is usualy done with a container class or a class that contains an array of some sort. Normaly, operator[] is a member of the class. Aditionaly the parameter char is usualy an int, used as an index for the array element that the user wishes to refernce. A common example: (not tested)

Code:
class A
{
     public:    
          A** &operator[](int index) const { return m_Array[index]; }

     private:
          A** m_Array[];
};
A*** var;

looks like var is indeed a triple pointer to an object of type A, see the following

http://www.experts-exchange.com/Prog..._21353282.html

I hope this helps, and that I didnt confuse you further. Also please feel to correct me if I am wrong, anyone.