Arrays of Pointers with overloaded operators
<p>When I run this code I get a bad_alloc error, Am I accessing the subscript operator wrong or something ? To me it makes sense that I go to the appropriate object, it gets returned and then the subscript operator should kick in ? By the way I want to use arrays and not vectors :)</p>

<pre><code>class A{
    public:
    A(int size)
    {
        array = new int[size];
    }
    int&amp; operator[](const int &amp;i)
    {
        return array[i]
    }
    private:
       int * array;
};

int main()  {
   A ** a = new A*[10];
   for(int i = 0; i &lt; 10; i++)  {
      a[i] = new A(10);
      for(int l = 0; l &lt; 10; l++)   {
         cout &lt;&lt; a[i][l] &lt;&lt; endl;
      }
   }
}
</code></pre>

<p>Thanks in advance</p>
