typedef synonymous substitution
<p>My understanding is typedef acts as a synonym for a type, or can be used as an alias for a particular type.  Also, the simplified codes below built perfectly.  The question here is if I change the second line in the main function to :</p>

<pre><code>Array&lt;int&gt;::ArrayIter&lt;T&gt; pa = a.begin(); // substituting back the typedef  “iterator” to its original form of ArrayIter&lt;T&gt;.
</code></pre>

<p>I get the following error message during compilation:</p>

<blockquote>
  <p>“ArrayIter” is not a member of “Array”</p>
</blockquote>

<p>But the codes compiled perfectly using the "typedef" (iterator) notation.  Why is “iterator” and ArrayIter suddenly not synonymous any more:</p>

<p>Reference codes below:</p>

<pre><code>template&lt;class T&gt; class ArrayIter {
public:
ArrayIter(T* p) : m_p(p) {
}

private:
T* m_p;
};

template&lt;class T&gt; class Array {

public:
  Array(int size) throw (const char*) {
    if ( size &gt; 0 ) {
       m_p = new T[size];
       m_size = size;
    } else {
   throw "Array: invalid array dimension";
}
  }

  // typedef and methods to support the new iterator for this class
  typedef ArrayIter&lt;T&gt; iterator;

  ArrayIter&lt;T&gt; begin() {
  return ArrayIter&lt;T&gt;(m_p);
  }

private:
  T* m_p;
  int m_size;
};


int main(int argc, char* argv[]) {

  Array&lt;int&gt; a(10);
  Array&lt;int&gt;::iterator pa = a.begin();

 return 0;
}
</code></pre>
