I am having problems figuring out the use of the & operator I think I understand how to use it as a reference pointer. But when using it after the variable I do not have a clue of whats going on. here is some example code of how T& is used. Below is a class template for a stack. I dont understand T& I do understand &T what is the difference in T& and &T I would appreciate your help
template < class T >
class Stack {
public:
Stack( int = 10 ); // default constructor stack size 10
~Stack() { delete [] stackPtr; } // destructor
bool push( const T& ); //push an element onto stack
bool pop( T& ); // pop an element off stack
private:
int size; // # of elements in stack
int top; // location of top element
T *stackPtr; // pointer to stack